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" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 36 | #include "sch_api.h" |
| 37 | #include "lim_send_messages.h" |
| 38 | #include "lim_assoc_utils.h" |
| 39 | #include "lim_ft.h" |
| 40 | #ifdef WLAN_FEATURE_11W |
| 41 | #include "wni_cfg.h" |
| 42 | #endif |
| 43 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 44 | #include "lim_ft_defs.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 45 | #include "lim_session.h" |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 46 | #include "qdf_types.h" |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 47 | #include "qdf_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 48 | #include "cds_utils.h" |
| 49 | #include "sme_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 50 | #include "rrm_api.h" |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 51 | #include "qdf_crypto.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 52 | |
| 53 | #include "wma_types.h" |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 54 | #include <cdp_txrx_cmn.h> |
Tushnim Bhattacharyya | 45ed04f | 2017-03-15 10:15:05 -0700 | [diff] [blame] | 55 | #include <cdp_txrx_peer_ops.h> |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 56 | #include "lim_process_fils.h" |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 57 | #include "wlan_utility.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * |
| 61 | * \brief This function is called to add the sequence number to the |
| 62 | * management frames |
| 63 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 64 | * \param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 65 | * |
| 66 | * \param pMacHdr Pointer to MAC management header |
| 67 | * |
| 68 | * The pMacHdr argument points to the MAC management header. The |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 69 | * sequence number stored in the mac structure will be incremented |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 70 | * and updated to the MAC management header. The start sequence |
| 71 | * number is WLAN_HOST_SEQ_NUM_MIN and the end value is |
| 72 | * WLAN_HOST_SEQ_NUM_MAX. After reaching the MAX value, the sequence |
| 73 | * number will roll over. |
| 74 | * |
| 75 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 76 | 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] | 77 | { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 78 | if (mac->mgmtSeqNum >= WLAN_HOST_SEQ_NUM_MAX) { |
| 79 | mac->mgmtSeqNum = WLAN_HOST_SEQ_NUM_MIN - 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 80 | } |
| 81 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 82 | mac->mgmtSeqNum++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 83 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 84 | pMacHdr->seqControl.seqNumLo = (mac->mgmtSeqNum & LOW_SEQ_NUM_MASK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 85 | pMacHdr->seqControl.seqNumHi = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 86 | ((mac->mgmtSeqNum & HIGH_SEQ_NUM_MASK) >> HIGH_SEQ_NUM_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 90 | * lim_populate_mac_header() - Fill in 802.11 header of frame |
| 91 | * |
| 92 | * @mac_ctx: Pointer to Global MAC structure |
| 93 | * @buf: Pointer to the frame buffer that needs to be populate |
| 94 | * @type: 802.11 Type of the frame |
| 95 | * @sub_type: 802.11 Subtype of the frame |
| 96 | * @peer_addr: dst address |
| 97 | * @self_mac_addr: local mac address |
| 98 | * |
| 99 | * This function is called by various LIM modules to prepare the |
| 100 | * 802.11 frame MAC header |
| 101 | * |
| 102 | * The buf argument points to the beginning of the frame buffer to |
| 103 | * which - a) The 802.11 MAC header is set b) Following this MAC header |
| 104 | * will be the MGMT frame payload The payload itself is populated by the |
| 105 | * caller API |
| 106 | * |
| 107 | * Return: None |
| 108 | */ |
| 109 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 110 | 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] | 111 | uint8_t type, uint8_t sub_type, tSirMacAddr peer_addr, |
| 112 | tSirMacAddr self_mac_addr) |
| 113 | { |
| 114 | tpSirMacMgmtHdr mac_hdr; |
| 115 | |
| 116 | /* Prepare MAC management header */ |
| 117 | mac_hdr = (tpSirMacMgmtHdr) (buf); |
| 118 | |
| 119 | /* Prepare FC */ |
| 120 | mac_hdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 121 | mac_hdr->fc.type = type; |
| 122 | mac_hdr->fc.subType = sub_type; |
| 123 | |
| 124 | /* Prepare Address 1 */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 125 | qdf_mem_copy((uint8_t *) mac_hdr->da, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 126 | (uint8_t *) peer_addr, sizeof(tSirMacAddr)); |
| 127 | |
| 128 | /* Prepare Address 2 */ |
| 129 | sir_copy_mac_addr(mac_hdr->sa, self_mac_addr); |
| 130 | |
| 131 | /* Prepare Address 3 */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 132 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 133 | (uint8_t *) peer_addr, sizeof(tSirMacAddr)); |
| 134 | |
| 135 | /* Prepare sequence number */ |
| 136 | lim_add_mgmt_seq_num(mac_ctx, mac_hdr); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 137 | pe_debug("seqNumLo=%d, seqNumHi=%d, mgmtSeqNum=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 138 | mac_hdr->seqControl.seqNumLo, |
| 139 | mac_hdr->seqControl.seqNumHi, mac_ctx->mgmtSeqNum); |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * lim_send_probe_req_mgmt_frame() - send probe request management frame |
| 144 | * @mac_ctx: Pointer to Global MAC structure |
| 145 | * @ssid: SSID to be sent in Probe Request frame |
| 146 | * @bssid: BSSID to be sent in Probe Request frame |
| 147 | * @channel: Channel # on which the Probe Request is going out |
| 148 | * @self_macaddr: self MAC address |
| 149 | * @dot11mode: self dotllmode |
| 150 | * @additional_ielen: if non-zero, include additional_ie in the Probe Request |
| 151 | * frame |
| 152 | * @additional_ie: if additional_ielen is non zero, include this field in the |
| 153 | * Probe Request frame |
| 154 | * |
| 155 | * This function is called by various LIM modules to send Probe Request frame |
| 156 | * during active scan/learn phase. |
| 157 | * Probe request is sent out in the following scenarios: |
| 158 | * --heartbeat failure: session needed |
| 159 | * --join req: session needed |
| 160 | * --foreground scan: no session |
| 161 | * --background scan: no session |
| 162 | * --sch_beacon_processing: to get EDCA parameters: session needed |
| 163 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 164 | * Return: QDF_STATUS (QDF_STATUS_SUCCESS on success and error codes otherwise) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 165 | */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 166 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 167 | lim_send_probe_req_mgmt_frame(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 168 | tSirMacSSid *ssid, |
| 169 | tSirMacAddr bssid, |
| 170 | uint8_t channel, |
| 171 | tSirMacAddr self_macaddr, |
| 172 | uint32_t dot11mode, |
Jeff Johnson | 919f2c3 | 2019-01-16 11:22:24 -0800 | [diff] [blame] | 173 | uint16_t *additional_ielen, |
| 174 | uint8_t *additional_ie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 175 | { |
| 176 | tDot11fProbeRequest pr; |
| 177 | uint32_t status, bytes, payload; |
| 178 | uint8_t *frame; |
| 179 | void *packet; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 180 | QDF_STATUS qdf_status; |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 181 | struct pe_session *pesession; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 182 | uint8_t sessionid; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 183 | const uint8_t *p2pie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 184 | uint8_t txflag = 0; |
| 185 | uint8_t sme_sessionid = 0; |
| 186 | bool is_vht_enabled = false; |
| 187 | uint8_t txPower; |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 188 | uint16_t addn_ielen = 0; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 189 | bool extracted_ext_cap_flag = false; |
| 190 | tDot11fIEExtCap extracted_ext_cap; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 191 | QDF_STATUS sir_status; |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 192 | const uint8_t *qcn_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 193 | |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 194 | if (additional_ielen) |
| 195 | addn_ielen = *additional_ielen; |
| 196 | |
Jeff Johnson | 919f2c3 | 2019-01-16 11:22:24 -0800 | [diff] [blame] | 197 | /* |
| 198 | * The probe req should not send 11ac capabilities if band is |
| 199 | * 2.4GHz, unless gEnableVhtFor24GHzBand is enabled in INI. So |
| 200 | * if gEnableVhtFor24GHzBand is false and dot11mode is 11ac |
| 201 | * set it to 11n. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 202 | */ |
| 203 | if (channel <= SIR_11B_CHANNEL_END && |
Abhinav Kumar | e057b41 | 2018-10-09 17:28:16 +0530 | [diff] [blame] | 204 | !mac_ctx->mlme_cfg->vht_caps.vht_cap_info.b24ghz_band && |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 205 | (MLME_DOT11_MODE_11AC == dot11mode || |
| 206 | MLME_DOT11_MODE_11AC_ONLY == dot11mode)) |
| 207 | dot11mode = MLME_DOT11_MODE_11N; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 208 | /* |
| 209 | * session context may or may not be present, when probe request needs |
| 210 | * to be sent out. Following cases exist: |
| 211 | * --heartbeat failure: session needed |
| 212 | * --join req: session needed |
| 213 | * --foreground scan: no session |
| 214 | * --background scan: no session |
| 215 | * --sch_beacon_processing: to get EDCA parameters: session needed |
| 216 | * If session context does not exist, some IEs will be populated from |
| 217 | * CFGs, e.g. Supported and Extended rate set IEs |
| 218 | */ |
| 219 | pesession = pe_find_session_by_bssid(mac_ctx, bssid, &sessionid); |
| 220 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 221 | if (pesession) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 222 | sme_sessionid = pesession->smeSessionId; |
| 223 | |
| 224 | /* The scheme here is to fill out a 'tDot11fProbeRequest' structure */ |
| 225 | /* and then hand it off to 'dot11f_pack_probe_request' (for */ |
| 226 | /* serialization). We start by zero-initializing the structure: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 227 | qdf_mem_zero((uint8_t *) &pr, sizeof(pr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 228 | |
| 229 | /* & delegating to assorted helpers: */ |
| 230 | populate_dot11f_ssid(mac_ctx, ssid, &pr.SSID); |
| 231 | |
| 232 | if (addn_ielen && additional_ie) |
| 233 | p2pie = limGetP2pIEPtr(mac_ctx, additional_ie, addn_ielen); |
| 234 | |
| 235 | /* |
| 236 | * Don't include 11b rate if it is a P2P serach or probe request is |
| 237 | * sent by P2P Client |
| 238 | */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 239 | if ((MLME_DOT11_MODE_11B != dot11mode) && (p2pie) && |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 240 | ((pesession) && (QDF_P2P_CLIENT_MODE == pesession->opmode))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 241 | /* |
| 242 | * In the below API pass channel number > 14, do that it fills |
| 243 | * only 11a rates in supported rates |
| 244 | */ |
| 245 | populate_dot11f_supp_rates(mac_ctx, 15, &pr.SuppRates, |
| 246 | pesession); |
| 247 | } else { |
| 248 | populate_dot11f_supp_rates(mac_ctx, channel, |
| 249 | &pr.SuppRates, pesession); |
| 250 | |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 251 | if (MLME_DOT11_MODE_11B != dot11mode) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 252 | populate_dot11f_ext_supp_rates1(mac_ctx, channel, |
| 253 | &pr.ExtSuppRates); |
| 254 | } |
| 255 | } |
| 256 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 257 | /* |
| 258 | * Table 7-14 in IEEE Std. 802.11k-2008 says |
| 259 | * DS params "can" be present in RRM is disabled and "is" present if |
| 260 | * RRM is enabled. It should be ok even if we add it into probe req when |
| 261 | * RRM is not enabled. |
| 262 | */ |
| 263 | populate_dot11f_ds_params(mac_ctx, &pr.DSParams, channel); |
| 264 | /* Call RRM module to get the tx power for management used. */ |
| 265 | txPower = (uint8_t) rrm_get_mgmt_tx_power(mac_ctx, pesession); |
| 266 | populate_dot11f_wfatpc(mac_ctx, &pr.WFATPC, txPower, 0); |
| 267 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 268 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 269 | if (pesession) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 270 | pesession->htCapability = IS_DOT11_MODE_HT(dot11mode); |
| 271 | /* Include HT Capability IE */ |
| 272 | if (pesession->htCapability) |
| 273 | populate_dot11f_ht_caps(mac_ctx, pesession, &pr.HTCaps); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 274 | } else { /* !pesession */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 275 | if (IS_DOT11_MODE_HT(dot11mode)) |
| 276 | populate_dot11f_ht_caps(mac_ctx, NULL, &pr.HTCaps); |
| 277 | } |
| 278 | |
| 279 | /* |
| 280 | * Set channelbonding information as "disabled" when tunned to a |
| 281 | * 2.4 GHz channel |
| 282 | */ |
| 283 | if (channel <= SIR_11B_CHANNEL_END) { |
| 284 | if (mac_ctx->roam.configParam.channelBondingMode24GHz |
| 285 | == PHY_SINGLE_CHANNEL_CENTERED) { |
| 286 | pr.HTCaps.supportedChannelWidthSet = |
| 287 | eHT_CHANNEL_WIDTH_20MHZ; |
| 288 | pr.HTCaps.shortGI40MHz = 0; |
| 289 | } else { |
| 290 | pr.HTCaps.supportedChannelWidthSet = |
| 291 | eHT_CHANNEL_WIDTH_40MHZ; |
| 292 | } |
| 293 | } |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 294 | if (pesession) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 295 | pesession->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); |
| 296 | /* Include VHT Capability IE */ |
| 297 | if (pesession->vhtCapability) { |
| 298 | populate_dot11f_vht_caps(mac_ctx, pesession, |
| 299 | &pr.VHTCaps); |
| 300 | is_vht_enabled = true; |
| 301 | } |
| 302 | } else { |
| 303 | if (IS_DOT11_MODE_VHT(dot11mode)) { |
| 304 | populate_dot11f_vht_caps(mac_ctx, pesession, |
| 305 | &pr.VHTCaps); |
| 306 | is_vht_enabled = true; |
| 307 | } |
| 308 | } |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 309 | if (pesession) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 310 | populate_dot11f_ext_cap(mac_ctx, is_vht_enabled, &pr.ExtCap, |
| 311 | pesession); |
| 312 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 313 | if (IS_DOT11_MODE_HE(dot11mode) && pesession) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 314 | lim_update_session_he_capable(mac_ctx, pesession); |
| 315 | |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 316 | pe_debug("Populate HE IEs"); |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 317 | populate_dot11f_he_caps(mac_ctx, pesession, &pr.he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 318 | |
Sandeep Puligilla | 493fea2 | 2018-04-30 15:31:17 -0700 | [diff] [blame] | 319 | if (addn_ielen && additional_ie) { |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 320 | qdf_mem_zero((uint8_t *)&extracted_ext_cap, |
| 321 | sizeof(tDot11fIEExtCap)); |
| 322 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 323 | additional_ie, |
| 324 | &addn_ielen, |
| 325 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 326 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 327 | pe_debug("Unable to Stripoff ExtCap IE from Probe Req"); |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 328 | } else { |
| 329 | struct s_ext_cap *p_ext_cap = |
| 330 | (struct s_ext_cap *) |
| 331 | extracted_ext_cap.bytes; |
| 332 | if (p_ext_cap->interworking_service) |
| 333 | p_ext_cap->qos_map = 1; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 334 | extracted_ext_cap.num_bytes = |
| 335 | lim_compute_ext_cap_ie_length |
| 336 | (&extracted_ext_cap); |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 337 | extracted_ext_cap_flag = |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 338 | (extracted_ext_cap.num_bytes > 0); |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 339 | if (additional_ielen) |
| 340 | *additional_ielen = addn_ielen; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 341 | } |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 342 | qcn_ie = wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_QCN_OUI_TYPE, |
| 343 | SIR_MAC_QCN_OUI_TYPE_SIZE, |
| 344 | additional_ie, addn_ielen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 345 | } |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 346 | /* Add qcn_ie only if qcn ie is not present in additional_ie */ |
Kiran Kumar Lokere | 89f01f0 | 2019-08-06 18:22:39 -0700 | [diff] [blame] | 347 | if (!qcn_ie) |
| 348 | populate_dot11f_qcn_ie(mac_ctx, &pr.qcn_ie, QCN_IE_ATTR_ID_ALL); |
| 349 | else |
| 350 | populate_dot11f_qcn_ie(mac_ctx, &pr.qcn_ie, |
| 351 | QCN_IE_ATTR_ID_VHT_MCS11); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 352 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 353 | /* |
| 354 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 355 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 356 | * dot11f get packed payload size. |
| 357 | */ |
| 358 | if (extracted_ext_cap_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 359 | lim_merge_extcap_struct(&pr.ExtCap, &extracted_ext_cap, true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 360 | |
| 361 | /* That's it-- now we pack it. First, how much space are we going to */ |
| 362 | status = dot11f_get_packed_probe_request_size(mac_ctx, &pr, &payload); |
| 363 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 364 | 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] | 365 | status); |
| 366 | /* We'll fall back on the worst case scenario: */ |
| 367 | payload = sizeof(tDot11fProbeRequest); |
| 368 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 369 | 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] | 370 | status); |
| 371 | } |
| 372 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 373 | bytes = payload + sizeof(tSirMacMgmtHdr) + addn_ielen; |
| 374 | |
| 375 | /* Ok-- try to allocate some memory: */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 376 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 377 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 378 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 379 | pe_err("Failed to allocate %d bytes for a Probe Request", bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 380 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 381 | } |
| 382 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 383 | qdf_mem_zero(frame, bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 384 | |
| 385 | /* Next, we fill out the buffer descriptor: */ |
| 386 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 387 | SIR_MAC_MGMT_PROBE_REQ, bssid, self_macaddr); |
| 388 | |
| 389 | /* That done, pack the Probe Request: */ |
| 390 | status = dot11f_pack_probe_request(mac_ctx, &pr, frame + |
| 391 | sizeof(tSirMacMgmtHdr), |
| 392 | payload, &payload); |
| 393 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 394 | pe_err("Failed to pack a Probe Request (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 395 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 396 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 397 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 398 | 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] | 399 | } |
| 400 | /* Append any AddIE if present. */ |
| 401 | if (addn_ielen) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 402 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 403 | additional_ie, addn_ielen); |
| 404 | payload += addn_ielen; |
| 405 | } |
| 406 | |
| 407 | /* If this probe request is sent during P2P Search State, then we need |
| 408 | * to send it at OFDM rate. |
| 409 | */ |
Abhishek Singh | 221cf99 | 2018-02-22 13:44:53 +0530 | [diff] [blame] | 410 | if ((BAND_5G == lim_get_rf_band(channel)) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 411 | /* |
| 412 | * For unicast probe req mgmt from Join function we don't set |
| 413 | * above variables. So we need to add one more check whether it |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 414 | * is opmode is P2P_CLIENT or not |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 415 | */ |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 416 | ((pesession) && (QDF_P2P_CLIENT_MODE == pesession->opmode))) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 417 | txflag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 418 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 419 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 420 | wma_tx_frame(mac_ctx, packet, |
| 421 | (uint16_t) sizeof(tSirMacMgmtHdr) + payload, |
| 422 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
| 423 | lim_tx_complete, frame, txflag, sme_sessionid, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 424 | 0, RATEID_DEFAULT); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 425 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 426 | pe_err("could not send Probe Request frame!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 427 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 428 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 429 | } |
| 430 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 431 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 432 | } /* End lim_send_probe_req_mgmt_frame. */ |
| 433 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 434 | 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] | 435 | uint8_t *addIE, uint16_t *addnIELen, |
| 436 | uint8_t probeReqP2pIe) |
| 437 | { |
| 438 | /* If Probe request doesn't have P2P IE, then take out P2P IE |
| 439 | from additional IE */ |
| 440 | if (!probeReqP2pIe) { |
| 441 | uint8_t *tempbuf = NULL; |
| 442 | uint16_t tempLen = 0; |
| 443 | int left = *addnIELen; |
| 444 | uint8_t *ptr = addIE; |
| 445 | uint8_t elem_id, elem_len; |
| 446 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 447 | if (!addIE) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 448 | pe_err("NULL addIE pointer"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 449 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 450 | } |
| 451 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 452 | tempbuf = qdf_mem_malloc(left); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 453 | if (!tempbuf) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 454 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 455 | |
| 456 | while (left >= 2) { |
| 457 | elem_id = ptr[0]; |
| 458 | elem_len = ptr[1]; |
| 459 | left -= 2; |
| 460 | if (elem_len > left) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 461 | pe_err("Invalid IEs eid: %d elem_len: %d left: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 462 | elem_id, elem_len, left); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 463 | qdf_mem_free(tempbuf); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 464 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 465 | } |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 466 | if (!((WLAN_ELEMID_VENDOR == elem_id) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 467 | (memcmp |
| 468 | (&ptr[2], SIR_MAC_P2P_OUI, |
| 469 | SIR_MAC_P2P_OUI_SIZE) == 0))) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 470 | qdf_mem_copy(tempbuf + tempLen, &ptr[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 471 | elem_len + 2); |
| 472 | tempLen += (elem_len + 2); |
| 473 | } |
| 474 | left -= elem_len; |
| 475 | ptr += (elem_len + 2); |
| 476 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 477 | qdf_mem_copy(addIE, tempbuf, tempLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 478 | *addnIELen = tempLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 479 | qdf_mem_free(tempbuf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 480 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 481 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 482 | } |
| 483 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 484 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 485 | lim_send_probe_rsp_mgmt_frame(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 486 | tSirMacAddr peer_macaddr, |
| 487 | tpAniSSID ssid, |
Jeff Johnson | 3c08ace | 2019-03-12 08:50:37 -0700 | [diff] [blame] | 488 | struct pe_session *pe_session, |
| 489 | uint8_t preq_p2pie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 490 | { |
| 491 | tDot11fProbeResponse *frm; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 492 | QDF_STATUS sir_status; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 493 | uint32_t cfg, payload, bytes = 0, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 494 | tpSirMacMgmtHdr mac_hdr; |
| 495 | uint8_t *frame; |
Arif Hussain | fbf5068 | 2016-06-15 12:57:43 -0700 | [diff] [blame] | 496 | void *packet = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 497 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 498 | uint32_t addn_ie_present = false; |
| 499 | |
| 500 | uint16_t addn_ie_len = 0; |
gaurank kathpalia | 837f620 | 2018-09-14 21:55:32 +0530 | [diff] [blame] | 501 | bool wps_ap = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 502 | uint8_t tx_flag = 0; |
| 503 | uint8_t *add_ie = NULL; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 504 | const uint8_t *p2p_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 505 | uint8_t noalen = 0; |
| 506 | uint8_t total_noalen = 0; |
| 507 | uint8_t noa_stream[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
| 508 | uint8_t noa_ie[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
| 509 | uint8_t sme_sessionid = 0; |
| 510 | bool is_vht_enabled = false; |
Padma, Santhosh Kumar | 9223447 | 2017-04-19 18:20:02 +0530 | [diff] [blame] | 511 | tDot11fIEExtCap extracted_ext_cap = {0}; |
Selvaraj, Sridhar | 94ece20 | 2016-06-23 20:44:09 +0530 | [diff] [blame] | 512 | bool extracted_ext_cap_flag = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 513 | |
| 514 | /* We don't answer requests in this case*/ |
Srinivas Girigowda | 35b0031 | 2017-06-27 21:52:03 -0700 | [diff] [blame] | 515 | if (ANI_DRIVER_TYPE(mac_ctx) == QDF_DRIVER_TYPE_MFG) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 516 | return; |
| 517 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 518 | if (!pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 519 | return; |
| 520 | |
| 521 | /* |
| 522 | * In case when cac timer is running for this SAP session then |
| 523 | * avoid sending probe rsp out. It is violation of dfs specification. |
| 524 | */ |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 525 | if (((pe_session->opmode == QDF_SAP_MODE) || |
| 526 | (pe_session->opmode == QDF_P2P_GO_MODE)) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 527 | (true == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 528 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 529 | FL("CAC timer is running, probe response dropped")); |
| 530 | return; |
| 531 | } |
| 532 | sme_sessionid = pe_session->smeSessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 533 | frm = qdf_mem_malloc(sizeof(tDot11fProbeResponse)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 534 | if (!frm) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 535 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 536 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 537 | /* |
| 538 | * Fill out 'frm', after which we'll just hand the struct off to |
| 539 | * 'dot11f_pack_probe_response'. |
| 540 | */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 541 | qdf_mem_zero((uint8_t *) frm, sizeof(tDot11fProbeResponse)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 542 | |
| 543 | /* |
| 544 | * Timestamp to be updated by TFP, below. |
| 545 | * |
| 546 | * Beacon Interval: |
| 547 | */ |
| 548 | if (LIM_IS_AP_ROLE(pe_session)) { |
| 549 | frm->BeaconInterval.interval = |
Jeff Johnson | ac05741 | 2019-01-06 11:08:55 -0800 | [diff] [blame] | 550 | mac_ctx->sch.beacon_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 551 | } else { |
Bala Venkatesh | 2fde2c6 | 2018-09-11 20:33:24 +0530 | [diff] [blame] | 552 | cfg = mac_ctx->mlme_cfg->sap_cfg.beacon_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 553 | frm->BeaconInterval.interval = (uint16_t) cfg; |
| 554 | } |
| 555 | |
| 556 | populate_dot11f_capabilities(mac_ctx, &frm->Capabilities, pe_session); |
| 557 | populate_dot11f_ssid(mac_ctx, (tSirMacSSid *) ssid, &frm->SSID); |
| 558 | populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 559 | &frm->SuppRates, pe_session); |
| 560 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 561 | populate_dot11f_ds_params( |
| 562 | mac_ctx, &frm->DSParams, |
| 563 | wlan_reg_freq_to_chan(mac_ctx->pdev, |
| 564 | pe_session->curr_op_freq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 565 | populate_dot11f_ibss_params(mac_ctx, &frm->IBSSParams, pe_session); |
| 566 | |
| 567 | if (LIM_IS_AP_ROLE(pe_session)) { |
| 568 | if (pe_session->wps_state != SAP_WPS_DISABLED) |
| 569 | populate_dot11f_probe_res_wpsi_es(mac_ctx, |
| 570 | &frm->WscProbeRes, |
| 571 | pe_session); |
| 572 | } else { |
gaurank kathpalia | 837f620 | 2018-09-14 21:55:32 +0530 | [diff] [blame] | 573 | wps_ap = mac_ctx->mlme_cfg->wps_params.enable_wps & |
| 574 | WNI_CFG_WPS_ENABLE_AP; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 575 | if (wps_ap) |
| 576 | populate_dot11f_wsc_in_probe_res(mac_ctx, |
| 577 | &frm->WscProbeRes); |
| 578 | |
| 579 | if (mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState == |
| 580 | eLIM_WSC_ENROLL_BEGIN) { |
| 581 | populate_dot11f_wsc_registrar_info_in_probe_res(mac_ctx, |
| 582 | &frm->WscProbeRes); |
| 583 | mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState = |
| 584 | eLIM_WSC_ENROLL_IN_PROGRESS; |
| 585 | } |
| 586 | |
| 587 | if (mac_ctx->lim.wscIeInfo.wscEnrollmentState == |
| 588 | eLIM_WSC_ENROLL_END) { |
| 589 | de_populate_dot11f_wsc_registrar_info_in_probe_res( |
| 590 | mac_ctx, &frm->WscProbeRes); |
| 591 | mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState = |
| 592 | eLIM_WSC_ENROLL_NOOP; |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | populate_dot11f_country(mac_ctx, &frm->Country, pe_session); |
| 597 | populate_dot11f_edca_param_set(mac_ctx, &frm->EDCAParamSet, pe_session); |
| 598 | |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 599 | if (pe_session->dot11mode != MLME_DOT11_MODE_11B) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 600 | populate_dot11f_erp_info(mac_ctx, &frm->ERPInfo, pe_session); |
| 601 | |
| 602 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 603 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 604 | &frm->ExtSuppRates, pe_session); |
| 605 | |
| 606 | /* Populate HT IEs, when operating in 11n */ |
| 607 | if (pe_session->htCapability) { |
| 608 | populate_dot11f_ht_caps(mac_ctx, pe_session, &frm->HTCaps); |
| 609 | populate_dot11f_ht_info(mac_ctx, &frm->HTInfo, pe_session); |
| 610 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 611 | if (pe_session->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 612 | pe_debug("Populate VHT IE in Probe Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 613 | populate_dot11f_vht_caps(mac_ctx, pe_session, &frm->VHTCaps); |
| 614 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
| 615 | &frm->VHTOperation); |
| 616 | /* |
| 617 | * we do not support multi users yet. |
| 618 | * populate_dot11f_vht_ext_bss_load( mac_ctx, |
| 619 | * &frm.VHTExtBssLoad ); |
| 620 | */ |
| 621 | is_vht_enabled = true; |
| 622 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 623 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 624 | if (lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 625 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 626 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 627 | &frm->he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 628 | populate_dot11f_he_operation(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 629 | &frm->he_op); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 630 | } |
| 631 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 632 | populate_dot11f_ext_cap(mac_ctx, is_vht_enabled, &frm->ExtCap, |
| 633 | pe_session); |
| 634 | |
| 635 | if (pe_session->pLimStartBssReq) { |
| 636 | populate_dot11f_wpa(mac_ctx, |
| 637 | &(pe_session->pLimStartBssReq->rsnIE), |
| 638 | &frm->WPA); |
| 639 | populate_dot11f_rsn_opaque(mac_ctx, |
| 640 | &(pe_session->pLimStartBssReq->rsnIE), |
| 641 | &frm->RSNOpaque); |
| 642 | } |
| 643 | |
| 644 | populate_dot11f_wmm(mac_ctx, &frm->WMMInfoAp, &frm->WMMParams, |
| 645 | &frm->WMMCaps, pe_session); |
| 646 | |
| 647 | #if defined(FEATURE_WLAN_WAPI) |
| 648 | if (pe_session->pLimStartBssReq) |
| 649 | populate_dot11f_wapi(mac_ctx, |
| 650 | &(pe_session->pLimStartBssReq->rsnIE), |
| 651 | &frm->WAPI); |
| 652 | #endif /* defined(FEATURE_WLAN_WAPI) */ |
| 653 | |
Liangwei Dong | d7c5e01 | 2018-12-16 23:56:50 -0500 | [diff] [blame] | 654 | /* |
| 655 | * Only use CFG for non-listen mode. This CFG is not working for |
| 656 | * concurrency. In listening mode, probe rsp IEs is passed in |
| 657 | * the message from SME to PE. |
| 658 | */ |
| 659 | addn_ie_present = |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 660 | (pe_session->add_ie_params.probeRespDataLen != 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 661 | |
| 662 | if (addn_ie_present) { |
| 663 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 664 | add_ie = qdf_mem_malloc( |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 665 | pe_session->add_ie_params.probeRespDataLen); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 666 | if (!add_ie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 667 | goto err_ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 668 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 669 | qdf_mem_copy(add_ie, |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 670 | pe_session->add_ie_params.probeRespData_buff, |
| 671 | pe_session->add_ie_params.probeRespDataLen); |
| 672 | addn_ie_len = pe_session->add_ie_params.probeRespDataLen; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 673 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 674 | 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] | 675 | add_ie, &addn_ie_len, preq_p2pie)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 676 | pe_err("Unable to get addn_ie"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 677 | goto err_ret; |
| 678 | } |
| 679 | |
| 680 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 681 | add_ie, &addn_ie_len, |
| 682 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 683 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 684 | pe_debug("Unable to strip off ExtCap IE"); |
Selvaraj, Sridhar | 94ece20 | 2016-06-23 20:44:09 +0530 | [diff] [blame] | 685 | } else { |
| 686 | extracted_ext_cap_flag = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 687 | } |
| 688 | |
| 689 | bytes = bytes + addn_ie_len; |
| 690 | |
| 691 | if (preq_p2pie) |
| 692 | p2p_ie = limGetP2pIEPtr(mac_ctx, &add_ie[0], |
| 693 | addn_ie_len); |
| 694 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 695 | if (p2p_ie) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 696 | /* get NoA attribute stream P2P IE */ |
| 697 | noalen = lim_get_noa_attr_stream(mac_ctx, |
| 698 | noa_stream, pe_session); |
| 699 | if (noalen != 0) { |
| 700 | total_noalen = |
| 701 | lim_build_p2p_ie(mac_ctx, &noa_ie[0], |
| 702 | &noa_stream[0], noalen); |
| 703 | bytes = bytes + total_noalen; |
| 704 | } |
| 705 | } |
| 706 | } |
| 707 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 708 | /* |
| 709 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 710 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 711 | * dot11f get packed payload size. |
| 712 | */ |
| 713 | if (extracted_ext_cap_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 714 | lim_merge_extcap_struct(&frm->ExtCap, &extracted_ext_cap, |
| 715 | true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 716 | |
| 717 | status = dot11f_get_packed_probe_response_size(mac_ctx, frm, &payload); |
| 718 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 719 | pe_err("Probe Response size error (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 720 | status); |
| 721 | /* We'll fall back on the worst case scenario: */ |
| 722 | payload = sizeof(tDot11fProbeResponse); |
| 723 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 724 | pe_warn("Probe Response size warning (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 725 | status); |
| 726 | } |
| 727 | |
| 728 | bytes += payload + sizeof(tSirMacMgmtHdr); |
| 729 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 730 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 731 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 732 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 733 | pe_err("Probe Response allocation failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 734 | goto err_ret; |
| 735 | } |
| 736 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 737 | qdf_mem_zero(frame, bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 738 | |
| 739 | /* Next, we fill out the buffer descriptor: */ |
| 740 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 741 | SIR_MAC_MGMT_PROBE_RSP, peer_macaddr, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 742 | pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 743 | |
| 744 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 745 | |
| 746 | sir_copy_mac_addr(mac_hdr->bssId, pe_session->bssId); |
| 747 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 748 | /* That done, pack the Probe Response: */ |
| 749 | status = |
| 750 | dot11f_pack_probe_response(mac_ctx, frm, |
| 751 | frame + sizeof(tSirMacMgmtHdr), |
| 752 | payload, &payload); |
| 753 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 754 | pe_err("Probe Response pack failure (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 755 | status); |
| 756 | goto err_ret; |
| 757 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 758 | pe_warn("Probe Response pack warning (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 759 | } |
| 760 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 761 | pe_debug("Sending Probe Response frame to"); |
Nishank Aggarwal | 46bd31a | 2017-03-10 16:23:53 +0530 | [diff] [blame] | 762 | lim_print_mac_addr(mac_ctx, peer_macaddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 763 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 764 | if (addn_ie_present) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 765 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 766 | &add_ie[0], addn_ie_len); |
| 767 | |
| 768 | if (noalen != 0) { |
| 769 | if (total_noalen > |
| 770 | (SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 771 | pe_err("Not able to insert NoA, total len=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 772 | total_noalen); |
| 773 | goto err_ret; |
| 774 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 775 | qdf_mem_copy(&frame[bytes - (total_noalen)], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 776 | &noa_ie[0], total_noalen); |
| 777 | } |
| 778 | } |
| 779 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 780 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 781 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 782 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 797 | if (add_ie) |
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: |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 804 | if (add_ie) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 805 | qdf_mem_free(add_ie); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 806 | if (frm) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 807 | qdf_mem_free(frm); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 808 | if (packet) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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 | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 833 | if (!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 | |
Srinivas Girigowda | 03cebc3 | 2019-05-17 16:50:31 -0700 | [diff] [blame] | 842 | AddTSReq.Action.action = QOS_ADD_TS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 843 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 844 | AddTSReq.Category.category = ACTION_CATEGORY_QOS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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 | |
Srinivas Girigowda | 03cebc3 | 2019-05-17 16:50:31 -0700 | [diff] [blame] | 896 | WMMAddTSReq.Action.action = QOS_ADD_TS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 897 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 898 | WMMAddTSReq.Category.category = ACTION_CATEGORY_WMM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 947 | SIR_MAC_MGMT_ACTION, peerMacAddr, pe_session->self_mac_addr); |
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 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 988 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 989 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 990 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 991 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 992 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 993 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 994 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 995 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 996 | pe_session, QDF_STATUS_SUCCESS, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 997 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 998 | |
| 999 | /* Queue Addts Response frame in high priority WQ */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1000 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1001 | TXRX_FRM_802_11_MGMT, |
| 1002 | ANI_TXDIR_TODS, |
| 1003 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1004 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1005 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1006 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1007 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1008 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 1009 | pe_err("Could not send an Add TS Request (%X", |
| 1010 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1011 | } /* End lim_send_addts_req_action_frame. */ |
| 1012 | |
| 1013 | /** |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1014 | * lim_assoc_rsp_tx_complete() - Confirmation for assoc rsp OTA |
| 1015 | * @context: pointer to global mac |
| 1016 | * @buf: buffer which is nothing but entire assoc rsp frame |
| 1017 | * @tx_complete : Sent status |
| 1018 | * @params; tx completion params |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1019 | * |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1020 | * Return: This returns QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1021 | */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1022 | static QDF_STATUS lim_assoc_rsp_tx_complete( |
| 1023 | void *context, |
| 1024 | qdf_nbuf_t buf, |
| 1025 | uint32_t tx_complete, |
| 1026 | void *params) |
| 1027 | { |
| 1028 | struct mac_context *mac_ctx = (struct mac_context *)context; |
| 1029 | tSirMacMgmtHdr *mac_hdr; |
| 1030 | struct pe_session *session_entry; |
| 1031 | uint8_t session_id; |
| 1032 | tpLimMlmAssocInd lim_assoc_ind; |
| 1033 | tpDphHashNode sta_ds; |
| 1034 | uint16_t aid; |
| 1035 | uint8_t *data; |
| 1036 | struct assoc_ind *sme_assoc_ind; |
| 1037 | struct scheduler_msg msg; |
| 1038 | tpSirAssocReq assoc_req; |
| 1039 | |
| 1040 | if (!buf) { |
| 1041 | pe_err("Assoc rsp frame buffer is NULL"); |
| 1042 | goto null_buf; |
| 1043 | } |
| 1044 | |
| 1045 | data = qdf_nbuf_data(buf); |
| 1046 | |
| 1047 | if (!data) { |
| 1048 | pe_err("Assoc rsp frame is NULL"); |
| 1049 | goto end; |
| 1050 | } |
| 1051 | |
| 1052 | mac_hdr = (tSirMacMgmtHdr *)data; |
| 1053 | |
| 1054 | session_entry = pe_find_session_by_bssid( |
| 1055 | mac_ctx, mac_hdr->sa, |
| 1056 | &session_id); |
| 1057 | if (!session_entry) { |
| 1058 | pe_err("session entry is NULL"); |
| 1059 | goto end; |
| 1060 | } |
| 1061 | |
| 1062 | sta_ds = dph_lookup_hash_entry(mac_ctx, |
| 1063 | (uint8_t *)mac_hdr->da, &aid, |
| 1064 | &session_entry->dph.dphHashTable); |
| 1065 | if (!sta_ds) { |
| 1066 | pe_err("sta_ds is NULL"); |
| 1067 | goto end; |
| 1068 | } |
| 1069 | |
| 1070 | /* Get a copy of the already parsed Assoc Request */ |
| 1071 | assoc_req = |
| 1072 | (tpSirAssocReq)session_entry->parsedAssocReq[sta_ds->assocId]; |
| 1073 | |
| 1074 | if (!assoc_req) { |
| 1075 | pe_err("assoc req for assoc_id:%d is NULL", sta_ds->assocId); |
| 1076 | goto end; |
| 1077 | } |
| 1078 | |
| 1079 | lim_assoc_ind = qdf_mem_malloc(sizeof(tLimMlmAssocInd)); |
| 1080 | if (!lim_assoc_ind) { |
| 1081 | pe_err("lim assoc ind is NULL"); |
| 1082 | goto free_assoc_req; |
| 1083 | } |
| 1084 | if (!lim_fill_lim_assoc_ind_params(lim_assoc_ind, mac_ctx, |
| 1085 | sta_ds, session_entry)) { |
| 1086 | pe_err("lim assoc ind fill error"); |
| 1087 | goto lim_assoc_ind; |
| 1088 | } |
| 1089 | |
| 1090 | sme_assoc_ind = qdf_mem_malloc(sizeof(struct assoc_ind)); |
| 1091 | if (!sme_assoc_ind) { |
| 1092 | pe_err("sme assoc ind is NULL"); |
| 1093 | goto lim_assoc_ind; |
| 1094 | } |
| 1095 | sme_assoc_ind->messageType = eWNI_SME_ASSOC_IND_UPPER_LAYER; |
| 1096 | lim_fill_sme_assoc_ind_params( |
| 1097 | mac_ctx, lim_assoc_ind, |
| 1098 | sme_assoc_ind, |
Chaoli Zhou | 98d1b3e | 2019-10-10 17:13:44 +0800 | [diff] [blame] | 1099 | session_entry, true); |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1100 | |
| 1101 | qdf_mem_zero(&msg, sizeof(struct scheduler_msg)); |
| 1102 | msg.type = eWNI_SME_ASSOC_IND_UPPER_LAYER; |
| 1103 | msg.bodyptr = sme_assoc_ind; |
| 1104 | msg.bodyval = 0; |
| 1105 | sme_assoc_ind->staId = sta_ds->staIndex; |
| 1106 | sme_assoc_ind->reassocReq = sta_ds->mlmStaContext.subType; |
| 1107 | sme_assoc_ind->timingMeasCap = sta_ds->timingMeasCap; |
Chaoli Zhou | 98d1b3e | 2019-10-10 17:13:44 +0800 | [diff] [blame] | 1108 | MTRACE(mac_trace_msg_tx(mac_ctx, session_entry->peSessionId, msg.type)); |
| 1109 | lim_sys_process_mmh_msg_api(mac_ctx, &msg); |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1110 | |
| 1111 | qdf_mem_free(lim_assoc_ind); |
| 1112 | if (assoc_req->assocReqFrame) { |
| 1113 | qdf_mem_free(assoc_req->assocReqFrame); |
| 1114 | assoc_req->assocReqFrame = NULL; |
| 1115 | } |
| 1116 | qdf_mem_free(session_entry->parsedAssocReq[sta_ds->assocId]); |
| 1117 | session_entry->parsedAssocReq[sta_ds->assocId] = NULL; |
| 1118 | qdf_nbuf_free(buf); |
| 1119 | |
| 1120 | return QDF_STATUS_SUCCESS; |
| 1121 | |
| 1122 | lim_assoc_ind: |
| 1123 | qdf_mem_free(lim_assoc_ind); |
| 1124 | free_assoc_req: |
| 1125 | if (assoc_req->assocReqFrame) { |
| 1126 | qdf_mem_free(assoc_req->assocReqFrame); |
| 1127 | assoc_req->assocReqFrame = NULL; |
| 1128 | } |
| 1129 | qdf_mem_free(session_entry->parsedAssocReq[sta_ds->assocId]); |
| 1130 | session_entry->parsedAssocReq[sta_ds->assocId] = NULL; |
| 1131 | end: |
| 1132 | qdf_nbuf_free(buf); |
| 1133 | null_buf: |
| 1134 | return QDF_STATUS_E_FAILURE; |
| 1135 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1136 | |
| 1137 | void |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1138 | lim_send_assoc_rsp_mgmt_frame( |
| 1139 | struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1140 | uint16_t status_code, uint16_t aid, tSirMacAddr peer_addr, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1141 | uint8_t subtype, tpDphHashNode sta, struct pe_session *pe_session, |
| 1142 | bool tx_complete) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1143 | { |
| 1144 | static tDot11fAssocResponse frm; |
| 1145 | uint8_t *frame; |
| 1146 | tpSirMacMgmtHdr mac_hdr; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1147 | QDF_STATUS sir_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1148 | uint8_t lle_mode = 0, addts; |
| 1149 | tHalBitVal qos_mode, wme_mode; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1150 | uint32_t payload, bytes = 0, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1151 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1152 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1153 | tUpdateBeaconParams beacon_params; |
| 1154 | uint8_t tx_flag = 0; |
| 1155 | uint32_t addn_ie_len = 0; |
| 1156 | uint8_t add_ie[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1157 | tpSirAssocReq assoc_req = NULL; |
| 1158 | uint8_t sme_session = 0; |
| 1159 | bool is_vht = false; |
| 1160 | uint16_t stripoff_len = 0; |
| 1161 | tDot11fIEExtCap extracted_ext_cap; |
| 1162 | bool extracted_flag = false; |
| 1163 | #ifdef WLAN_FEATURE_11W |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 1164 | uint8_t retry_int; |
| 1165 | uint16_t max_retries; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1166 | #endif |
| 1167 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1168 | if (!pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1169 | pe_err("pe_session is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1170 | return; |
| 1171 | } |
| 1172 | |
| 1173 | sme_session = pe_session->smeSessionId; |
| 1174 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1175 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1176 | |
| 1177 | limGetQosMode(pe_session, &qos_mode); |
| 1178 | limGetWmeMode(pe_session, &wme_mode); |
| 1179 | |
| 1180 | /* |
| 1181 | * An Add TS IE is added only if the AP supports it and |
| 1182 | * the requesting STA sent a traffic spec. |
| 1183 | */ |
| 1184 | addts = (qos_mode && sta && sta->qos.addtsPresent) ? 1 : 0; |
| 1185 | |
| 1186 | frm.Status.status = status_code; |
| 1187 | |
| 1188 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1189 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1190 | if (!sta) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1191 | populate_dot11f_supp_rates(mac_ctx, |
| 1192 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1193 | &frm.SuppRates, pe_session); |
| 1194 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 1195 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1196 | &frm.ExtSuppRates, pe_session); |
| 1197 | } else { |
| 1198 | populate_dot11f_assoc_rsp_rates(mac_ctx, &frm.SuppRates, |
| 1199 | &frm.ExtSuppRates, |
| 1200 | sta->supportedRates.llbRates, |
| 1201 | sta->supportedRates.llaRates); |
| 1202 | } |
| 1203 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1204 | if (LIM_IS_AP_ROLE(pe_session) && sta && |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1205 | QDF_STATUS_SUCCESS == status_code) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1206 | assoc_req = (tpSirAssocReq) |
| 1207 | pe_session->parsedAssocReq[sta->assocId]; |
| 1208 | /* |
| 1209 | * populate P2P IE in AssocRsp when assocReq from the peer |
| 1210 | * includes P2P IE |
| 1211 | */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1212 | if (assoc_req && assoc_req->addIEPresent) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1213 | populate_dot11_assoc_res_p2p_ie(mac_ctx, |
| 1214 | &frm.P2PAssocRes, |
| 1215 | assoc_req); |
| 1216 | } |
| 1217 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1218 | if (sta) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1219 | if (eHAL_SET == qos_mode) { |
| 1220 | if (sta->lleEnabled) { |
| 1221 | lle_mode = 1; |
| 1222 | populate_dot11f_edca_param_set(mac_ctx, |
| 1223 | &frm.EDCAParamSet, pe_session); |
| 1224 | } |
| 1225 | } |
| 1226 | |
| 1227 | if ((!lle_mode) && (eHAL_SET == wme_mode) && sta->wmeEnabled) { |
| 1228 | populate_dot11f_wmm_params(mac_ctx, &frm.WMMParams, |
| 1229 | pe_session); |
| 1230 | |
| 1231 | if (sta->wsmEnabled) |
| 1232 | populate_dot11f_wmm_caps(&frm.WMMCaps); |
| 1233 | } |
| 1234 | |
| 1235 | if (sta->mlmStaContext.htCapability && |
| 1236 | pe_session->htCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1237 | pe_debug("Populate HT IEs in Assoc Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1238 | populate_dot11f_ht_caps(mac_ctx, pe_session, |
| 1239 | &frm.HTCaps); |
Krunal Soni | ef3294b | 2015-06-12 15:12:19 -0700 | [diff] [blame] | 1240 | /* |
| 1241 | * Check the STA capability and |
| 1242 | * update the HTCaps accordingly |
| 1243 | */ |
| 1244 | frm.HTCaps.supportedChannelWidthSet = ( |
| 1245 | sta->htSupportedChannelWidthSet < |
| 1246 | pe_session->htSupportedChannelWidthSet) ? |
| 1247 | sta->htSupportedChannelWidthSet : |
| 1248 | pe_session->htSupportedChannelWidthSet; |
| 1249 | if (!frm.HTCaps.supportedChannelWidthSet) |
| 1250 | frm.HTCaps.shortGI40MHz = 0; |
| 1251 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1252 | populate_dot11f_ht_info(mac_ctx, &frm.HTInfo, |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 1253 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1254 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1255 | 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] | 1256 | frm.HTCaps.supportedChannelWidthSet, |
| 1257 | frm.HTCaps.mimoPowerSave, |
| 1258 | frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, |
| 1259 | frm.HTCaps.shortGI40MHz, |
| 1260 | frm.HTCaps.dsssCckMode40MHz, |
| 1261 | frm.HTCaps.maxRxAMPDUFactor); |
| 1262 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1263 | if (sta->mlmStaContext.vhtCapability && |
| 1264 | pe_session->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1265 | pe_debug("Populate VHT IEs in Assoc Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1266 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
| 1267 | &frm.VHTCaps); |
| 1268 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1269 | &frm.VHTOperation); |
| 1270 | is_vht = true; |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 1271 | } else if (sta->mlmStaContext.force_1x1 && |
| 1272 | frm.HTCaps.present) { |
| 1273 | /* |
| 1274 | * WAR: In P2P GO mode, if the P2P client device |
| 1275 | * is only HT capable and not VHT capable, but the P2P |
| 1276 | * GO device is VHT capable and advertises 2x2 NSS with |
| 1277 | * HT capablity client device, which results in IOT |
| 1278 | * issues. |
| 1279 | * When GO is operating in DBS mode, GO beacons |
| 1280 | * advertise 2x2 capability but include OMN IE to |
| 1281 | * indicate current operating mode of 1x1. But here |
| 1282 | * peer device is only HT capable and will not |
| 1283 | * understand OMN IE. |
| 1284 | */ |
| 1285 | frm.HTInfo.basicMCSSet[1] = 0; |
| 1286 | frm.HTCaps.supportedMCSSet[1] = 0; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1287 | } |
Naveen Rawat | 903acca | 2017-09-15 17:32:13 -0700 | [diff] [blame] | 1288 | |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1289 | if (pe_session->vhtCapability && |
| 1290 | pe_session->vendor_vht_sap && |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1291 | (assoc_req) && |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1292 | assoc_req->vendor_vht_ie.VHTCaps.present) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1293 | pe_debug("Populate Vendor VHT IEs in Assoc Rsponse"); |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1294 | frm.vendor_vht_ie.present = 1; |
Kiran Kumar Lokere | 8172263 | 2017-09-26 12:11:43 -0700 | [diff] [blame] | 1295 | frm.vendor_vht_ie.sub_type = |
| 1296 | pe_session->vendor_specific_vht_ie_sub_type; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1297 | frm.vendor_vht_ie.VHTCaps.present = 1; |
| 1298 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
| 1299 | &frm.vendor_vht_ie.VHTCaps); |
Kiran Kumar Lokere | cc44868 | 2017-07-20 18:08:01 -0700 | [diff] [blame] | 1300 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
| 1301 | &frm.vendor_vht_ie.VHTOperation); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1302 | is_vht = true; |
Kiran Kumar Lokere | 89f01f0 | 2019-08-06 18:22:39 -0700 | [diff] [blame] | 1303 | populate_dot11f_qcn_ie(mac_ctx, &frm.qcn_ie, |
| 1304 | QCN_IE_ATTR_ID_ALL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1305 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1306 | populate_dot11f_ext_cap(mac_ctx, is_vht, &frm.ExtCap, |
| 1307 | pe_session); |
| 1308 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1309 | if (lim_is_sta_he_capable(sta) && |
| 1310 | lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1311 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1312 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1313 | &frm.he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1314 | populate_dot11f_he_operation(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1315 | &frm.he_op); |
Kiran Kumar Lokere | b2ea027 | 2019-08-27 19:16:36 -0700 | [diff] [blame] | 1316 | populate_dot11f_he_6ghz_cap(mac_ctx, pe_session, |
| 1317 | &frm.he_6ghz_band_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1318 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1319 | #ifdef WLAN_FEATURE_11W |
| 1320 | if (eSIR_MAC_TRY_AGAIN_LATER == status_code) { |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 1321 | max_retries = |
| 1322 | mac_ctx->mlme_cfg->gen.pmf_sa_query_max_retries; |
| 1323 | retry_int = |
| 1324 | mac_ctx->mlme_cfg->gen.pmf_sa_query_retry_interval; |
| 1325 | populate_dot11f_timeout_interval(mac_ctx, |
| 1326 | &frm.TimeoutInterval, |
| 1327 | SIR_MAC_TI_TYPE_ASSOC_COMEBACK, |
| 1328 | (max_retries - |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1329 | sta->pmfSaQueryRetryCount) |
| 1330 | * retry_int); |
| 1331 | } |
| 1332 | #endif |
Arif Hussain | 0c81692 | 2017-04-06 15:04:44 -0700 | [diff] [blame] | 1333 | |
| 1334 | if (LIM_IS_AP_ROLE(pe_session) && sta->non_ecsa_capable) |
| 1335 | pe_session->lim_non_ecsa_cap_num++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1336 | } |
| 1337 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1338 | qdf_mem_zero((uint8_t *) &beacon_params, sizeof(beacon_params)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1339 | |
| 1340 | if (LIM_IS_AP_ROLE(pe_session) && |
Pragaspathi Thilagaraj | 1ee7600 | 2018-09-18 21:38:51 +0530 | [diff] [blame] | 1341 | (pe_session->gLimProtectionControl != |
| 1342 | MLME_FORCE_POLICY_PROTECTION_DISABLE)) |
| 1343 | lim_decide_ap_protection(mac_ctx, peer_addr, &beacon_params, |
| 1344 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1345 | |
| 1346 | lim_update_short_preamble(mac_ctx, peer_addr, &beacon_params, |
| 1347 | pe_session); |
| 1348 | lim_update_short_slot_time(mac_ctx, peer_addr, &beacon_params, |
| 1349 | pe_session); |
| 1350 | |
| 1351 | /* |
| 1352 | * Populate Do11capabilities after updating session with |
| 1353 | * Assos req details |
| 1354 | */ |
| 1355 | populate_dot11f_capabilities(mac_ctx, &frm.Capabilities, pe_session); |
| 1356 | |
Abhishek Singh | c70afa3 | 2019-09-19 15:17:21 +0530 | [diff] [blame] | 1357 | beacon_params.bss_idx = pe_session->vdev_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1358 | |
| 1359 | /* Send message to HAL about beacon parameter change. */ |
| 1360 | if ((false == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running) |
| 1361 | && beacon_params.paramChangeBitmap) { |
| 1362 | sch_set_fixed_beacon_fields(mac_ctx, pe_session); |
| 1363 | lim_send_beacon_params(mac_ctx, &beacon_params, pe_session); |
| 1364 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1365 | |
Arif Hussain | 1513cb2 | 2018-01-05 19:56:31 -0800 | [diff] [blame] | 1366 | lim_obss_send_detection_cfg(mac_ctx, pe_session, false); |
| 1367 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1368 | if (assoc_req) { |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 1369 | addn_ie_len = pe_session->add_ie_params.assocRespDataLen; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1370 | |
| 1371 | /* Nonzero length indicates Assoc rsp IE available */ |
Krishna Kumaar Natarajan | e4e3a14 | 2016-04-01 16:27:51 -0700 | [diff] [blame] | 1372 | if (addn_ie_len > 0 && |
| 1373 | addn_ie_len <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && |
| 1374 | (bytes + addn_ie_len) <= SIR_MAX_PACKET_SIZE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1375 | qdf_mem_copy(add_ie, |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 1376 | pe_session->add_ie_params.assocRespData_buff, |
| 1377 | pe_session->add_ie_params.assocRespDataLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1378 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1379 | qdf_mem_zero((uint8_t *) &extracted_ext_cap, |
| 1380 | sizeof(extracted_ext_cap)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1381 | |
| 1382 | stripoff_len = addn_ie_len; |
| 1383 | sir_status = |
| 1384 | lim_strip_extcap_update_struct |
| 1385 | (mac_ctx, &add_ie[0], &stripoff_len, |
| 1386 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1387 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1388 | pe_debug("strip off extcap IE failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1389 | } else { |
| 1390 | addn_ie_len = stripoff_len; |
| 1391 | extracted_flag = true; |
| 1392 | } |
| 1393 | bytes = bytes + addn_ie_len; |
| 1394 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1395 | pe_debug("addn_ie_len: %d for Assoc Resp: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1396 | addn_ie_len, assoc_req->addIEPresent); |
| 1397 | } |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1398 | |
| 1399 | /* |
| 1400 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 1401 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 1402 | * dot11f get packed payload size. |
| 1403 | */ |
| 1404 | if (extracted_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1405 | lim_merge_extcap_struct(&(frm.ExtCap), &extracted_ext_cap, |
| 1406 | true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1407 | |
| 1408 | /* Allocate a buffer for this frame: */ |
| 1409 | status = dot11f_get_packed_assoc_response_size(mac_ctx, &frm, &payload); |
| 1410 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1411 | pe_err("get Association Response size failure (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1412 | status); |
| 1413 | return; |
| 1414 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1415 | pe_warn("get Association Response size warning (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1416 | status); |
| 1417 | } |
| 1418 | |
| 1419 | bytes += sizeof(tSirMacMgmtHdr) + payload; |
| 1420 | |
Min Liu | 0daa098 | 2019-02-01 17:50:44 +0800 | [diff] [blame] | 1421 | if (sta) |
| 1422 | bytes += sta->mlmStaContext.owe_ie_len; |
| 1423 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1424 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1425 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1426 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1427 | pe_err("cds_packet_alloc failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1428 | return; |
| 1429 | } |
| 1430 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1431 | qdf_mem_zero(frame, bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1432 | |
| 1433 | /* Next, we fill out the buffer descriptor: */ |
| 1434 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 1435 | (LIM_ASSOC == subtype) ? |
| 1436 | SIR_MAC_MGMT_ASSOC_RSP : SIR_MAC_MGMT_REASSOC_RSP, |
| 1437 | peer_addr, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 1438 | pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1439 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 1440 | |
| 1441 | sir_copy_mac_addr(mac_hdr->bssId, pe_session->bssId); |
| 1442 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1443 | status = dot11f_pack_assoc_response(mac_ctx, &frm, |
| 1444 | frame + sizeof(tSirMacMgmtHdr), |
| 1445 | payload, &payload); |
| 1446 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1447 | pe_err("Association Response pack failure(0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1448 | status); |
| 1449 | cds_packet_free((void *)packet); |
| 1450 | return; |
| 1451 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1452 | pe_warn("Association Response pack warning (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1453 | status); |
| 1454 | } |
| 1455 | |
| 1456 | if (subtype == LIM_ASSOC) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1457 | pe_debug("*** Sending Assoc Resp status %d aid %d to", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1458 | status_code, aid); |
| 1459 | else |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1460 | pe_debug("*** Sending ReAssoc Resp status %d aid %d to", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1461 | status_code, aid); |
| 1462 | |
Abhishek Singh | 5d8d733 | 2017-08-10 15:15:24 +0530 | [diff] [blame] | 1463 | lim_print_mac_addr(mac_ctx, mac_hdr->da, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1464 | |
| 1465 | 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] | 1466 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1467 | &add_ie[0], addn_ie_len); |
| 1468 | |
Min Liu | 0daa098 | 2019-02-01 17:50:44 +0800 | [diff] [blame] | 1469 | if (sta && sta->mlmStaContext.owe_ie_len) |
| 1470 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload |
| 1471 | + addn_ie_len, |
| 1472 | sta->mlmStaContext.owe_ie, |
| 1473 | sta->mlmStaContext.owe_ie_len); |
| 1474 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 1475 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 1476 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 1477 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1478 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1479 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1480 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1481 | pe_session->peSessionId, mac_hdr->fc.subType)); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 1482 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1483 | pe_session, QDF_STATUS_SUCCESS, status_code); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1484 | /* Queue Association Response frame in high priority WQ */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1485 | if (tx_complete) |
| 1486 | qdf_status = wma_tx_frameWithTxComplete( |
| 1487 | mac_ctx, packet, (uint16_t)bytes, |
| 1488 | TXRX_FRM_802_11_MGMT, |
| 1489 | ANI_TXDIR_TODS, |
| 1490 | 7, lim_tx_complete, frame, |
| 1491 | lim_assoc_rsp_tx_complete, tx_flag, |
| 1492 | sme_session, false, 0, RATEID_DEFAULT); |
| 1493 | else |
| 1494 | qdf_status = wma_tx_frame( |
| 1495 | mac_ctx, packet, (uint16_t)bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1496 | TXRX_FRM_802_11_MGMT, |
| 1497 | ANI_TXDIR_TODS, |
| 1498 | 7, lim_tx_complete, frame, tx_flag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1499 | sme_session, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1500 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1501 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1502 | |
| 1503 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1504 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1505 | pe_err("Could not Send Re/AssocRsp, retCode=%X", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1506 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1507 | |
| 1508 | /* |
| 1509 | * update the ANI peer station count. |
| 1510 | * FIXME_PROTECTION : take care of different type of station |
| 1511 | * counter inside this function. |
| 1512 | */ |
| 1513 | lim_util_count_sta_add(mac_ctx, sta, pe_session); |
| 1514 | |
| 1515 | } |
| 1516 | |
| 1517 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1518 | lim_send_delts_req_action_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1519 | tSirMacAddr peer, |
| 1520 | uint8_t wmmTspecPresent, |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1521 | struct mac_ts_info *pTsinfo, |
Jeff Johnson | 56471b9 | 2018-12-22 14:36:06 -0800 | [diff] [blame] | 1522 | struct mac_tspec_ie *pTspecIe, |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1523 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1524 | { |
| 1525 | uint8_t *pFrame; |
| 1526 | tpSirMacMgmtHdr pMacHdr; |
| 1527 | tDot11fDelTS DelTS; |
| 1528 | tDot11fWMMDelTS WMMDelTS; |
| 1529 | uint32_t nBytes, nPayload, nStatus; |
| 1530 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1531 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1532 | uint8_t txFlag = 0; |
| 1533 | uint8_t smeSessionId = 0; |
| 1534 | |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1535 | if (!pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1536 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1537 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1538 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1539 | |
| 1540 | if (!wmmTspecPresent) { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1541 | qdf_mem_zero((uint8_t *) &DelTS, sizeof(DelTS)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1542 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 1543 | DelTS.Category.category = ACTION_CATEGORY_QOS; |
Srinivas Girigowda | 03cebc3 | 2019-05-17 16:50:31 -0700 | [diff] [blame] | 1544 | DelTS.Action.action = QOS_DEL_TS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1545 | populate_dot11f_ts_info(pTsinfo, &DelTS.TSInfo); |
| 1546 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1547 | nStatus = dot11f_get_packed_del_ts_size(mac, &DelTS, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1548 | if (DOT11F_FAILED(nStatus)) { |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1549 | pe_err("Failed to calculate the packed size for a Del TS (0x%08x)", |
| 1550 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1551 | /* We'll fall back on the worst case scenario: */ |
| 1552 | nPayload = sizeof(tDot11fDelTS); |
| 1553 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1554 | pe_warn("There were warnings while calculating the packed size for a Del TS (0x%08x)", |
| 1555 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1556 | } |
| 1557 | } else { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1558 | qdf_mem_zero((uint8_t *) &WMMDelTS, sizeof(WMMDelTS)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1559 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 1560 | WMMDelTS.Category.category = ACTION_CATEGORY_WMM; |
Srinivas Girigowda | 03cebc3 | 2019-05-17 16:50:31 -0700 | [diff] [blame] | 1561 | WMMDelTS.Action.action = QOS_DEL_TS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1562 | WMMDelTS.DialogToken.token = 0; |
| 1563 | WMMDelTS.StatusCode.statusCode = 0; |
| 1564 | populate_dot11f_wmmtspec(pTspecIe, &WMMDelTS.WMMTSPEC); |
| 1565 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1566 | dot11f_get_packed_wmm_del_ts_size(mac, &WMMDelTS, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1567 | if (DOT11F_FAILED(nStatus)) { |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1568 | pe_err("Failed to calculate the packed size for a WMM Del TS (0x%08x)", |
| 1569 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1570 | /* We'll fall back on the worst case scenario: */ |
| 1571 | nPayload = sizeof(tDot11fDelTS); |
| 1572 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1573 | pe_warn("There were warnings while calculating the packed size for a WMM Del TS (0x%08x)", |
| 1574 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1575 | } |
| 1576 | } |
| 1577 | |
| 1578 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 1579 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1580 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1581 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 1582 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1583 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1584 | pe_err("Failed to allocate %d bytes for an Add TS Response", |
| 1585 | nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1586 | return; |
| 1587 | } |
| 1588 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1589 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1590 | |
| 1591 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1592 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 1593 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1594 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 1595 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1596 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1597 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1598 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1599 | |
| 1600 | /* That done, pack the struct: */ |
| 1601 | if (!wmmTspecPresent) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1602 | nStatus = dot11f_pack_del_ts(mac, &DelTS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1603 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1604 | nPayload, &nPayload); |
| 1605 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1606 | pe_err("Failed to pack a Del TS frame (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1607 | nStatus); |
| 1608 | cds_packet_free((void *)pPacket); |
| 1609 | return; /* allocated! */ |
| 1610 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1611 | pe_warn("There were warnings while packing a Del TS frame (0x%08x)", |
| 1612 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1613 | } |
| 1614 | } else { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1615 | nStatus = dot11f_pack_wmm_del_ts(mac, &WMMDelTS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1616 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1617 | nPayload, &nPayload); |
| 1618 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1619 | pe_err("Failed to pack a WMM Del TS frame (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1620 | nStatus); |
| 1621 | cds_packet_free((void *)pPacket); |
| 1622 | return; /* allocated! */ |
| 1623 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1624 | pe_warn("There were warnings while packing a WMM Del TS frame (0x%08x)", |
| 1625 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1626 | } |
| 1627 | } |
| 1628 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1629 | pe_debug("Sending DELTS REQ (size %d) to ", nBytes); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1630 | lim_print_mac_addr(mac, pMacHdr->da, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1631 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 1632 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 1633 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 1634 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1635 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1636 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1637 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1638 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1639 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1640 | pe_session, QDF_STATUS_SUCCESS, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1641 | QDF_STATUS_SUCCESS); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1642 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1643 | TXRX_FRM_802_11_MGMT, |
| 1644 | ANI_TXDIR_TODS, |
| 1645 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1646 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1647 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1648 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1649 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1650 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1651 | pe_err("Failed to send Del TS (%X)!", qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1652 | |
| 1653 | } /* End lim_send_delts_req_action_frame. */ |
| 1654 | |
| 1655 | /** |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1656 | * lim_assoc_tx_complete_cnf()- Confirmation for assoc sent over the air |
| 1657 | * @context: pointer to global mac |
| 1658 | * @buf: buffer |
| 1659 | * @tx_complete : Sent status |
| 1660 | * @params; tx completion params |
| 1661 | * |
| 1662 | * Return: This returns QDF_STATUS |
| 1663 | */ |
| 1664 | |
| 1665 | static QDF_STATUS lim_assoc_tx_complete_cnf(void *context, |
| 1666 | qdf_nbuf_t buf, |
| 1667 | uint32_t tx_complete, |
| 1668 | void *params) |
| 1669 | { |
| 1670 | uint16_t assoc_ack_status; |
| 1671 | uint16_t reason_code; |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1672 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1673 | |
| 1674 | pe_debug("tx_complete= %d", tx_complete); |
Zhu Jianmin | 5d8e3fe | 2018-01-04 16:16:20 +0800 | [diff] [blame] | 1675 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) { |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1676 | assoc_ack_status = ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1677 | reason_code = QDF_STATUS_SUCCESS; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1678 | } else { |
| 1679 | assoc_ack_status = NOT_ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1680 | reason_code = QDF_STATUS_E_FAILURE; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1681 | } |
| 1682 | if (buf) |
| 1683 | qdf_nbuf_free(buf); |
| 1684 | |
| 1685 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_ACK_EVENT, |
| 1686 | NULL, assoc_ack_status, reason_code); |
| 1687 | return QDF_STATUS_SUCCESS; |
| 1688 | } |
| 1689 | |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 1690 | #ifdef WLAN_ADAPTIVE_11R |
| 1691 | /** |
| 1692 | * lim_fill_adaptive_11r_ie() - Populate the Vendor secific adaptive 11r |
| 1693 | * IE to association request frame |
| 1694 | * @pe_session: pointer to PE session |
| 1695 | * @ie_buf: buffer to which Adaptive 11r IE will be copied |
| 1696 | * @ie_len: length of the Adaptive 11r Vendor specific IE |
| 1697 | * |
| 1698 | * Return QDF_STATUS |
| 1699 | */ |
| 1700 | static QDF_STATUS lim_fill_adaptive_11r_ie(struct pe_session *pe_session, |
| 1701 | uint8_t **ie_buf, uint8_t *ie_len) |
| 1702 | { |
| 1703 | uint8_t *buf = NULL, *adaptive_11r_ie = NULL; |
| 1704 | |
| 1705 | if (!pe_session->is_adaptive_11r_connection) |
| 1706 | return QDF_STATUS_SUCCESS; |
| 1707 | |
| 1708 | /* |
| 1709 | * Vendor specific Adaptive 11r IE to be advertised in Assoc |
| 1710 | * req: |
| 1711 | * Type 0xDD |
| 1712 | * Length 0x0B |
| 1713 | * OUI 0x00 0x00 0x0F |
| 1714 | * Type 0x22 |
| 1715 | * subtype 0x00 |
| 1716 | * Version 0x01 |
| 1717 | * Length 0x04 |
| 1718 | * Data 0x00 00 00 01(0th bit is 1 means adaptive 11r is |
| 1719 | * supported) |
| 1720 | */ |
| 1721 | adaptive_11r_ie = qdf_mem_malloc(ADAPTIVE_11R_STA_IE_LEN + 2); |
| 1722 | if (!adaptive_11r_ie) |
| 1723 | return QDF_STATUS_E_FAILURE; |
| 1724 | |
| 1725 | /* Fill the Vendor IE Type (0xDD) */ |
| 1726 | buf = adaptive_11r_ie; |
Srinivas Girigowda | 8e7ecab | 2019-05-16 11:31:19 -0700 | [diff] [blame] | 1727 | *buf = WLAN_ELEMID_VENDOR; |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 1728 | buf++; |
| 1729 | |
| 1730 | /* Fill the Vendor IE length (0x0B) */ |
| 1731 | *buf = ADAPTIVE_11R_STA_IE_LEN; |
| 1732 | buf++; |
| 1733 | |
| 1734 | /* |
| 1735 | * Fill the Adaptive 11r Vendor specific OUI(0x00 0x00 0x0F 0x22) |
| 1736 | */ |
| 1737 | qdf_mem_copy(buf, ADAPTIVE_11R_STA_OUI, ADAPTIVE_11R_OUI_LEN); |
| 1738 | buf += ADAPTIVE_11R_OUI_LEN; |
| 1739 | |
| 1740 | /* Fill Adaptive 11r Vendor specific Subtype (0x00) */ |
| 1741 | *buf = ADAPTIVE_11R_OUI_SUBTYPE; |
| 1742 | buf++; |
| 1743 | |
| 1744 | /* Fill Adaptive 11r Version (0x01) */ |
| 1745 | *buf = ADAPTIVE_11R_OUI_VERSION; |
| 1746 | buf++; |
| 1747 | |
| 1748 | /* Fill Adaptive 11r IE Data length (0x04) */ |
| 1749 | *buf = ADAPTIVE_11R_DATA_LEN; |
| 1750 | buf++; |
| 1751 | |
| 1752 | /* Fill Adaptive 11r IE Data (0x00 0x00 0x00 0x01) */ |
| 1753 | qdf_mem_copy(buf, ADAPTIVE_11R_OUI_DATA, ADAPTIVE_11R_DATA_LEN); |
| 1754 | |
| 1755 | *ie_len = ADAPTIVE_11R_STA_IE_LEN + 2; |
| 1756 | *ie_buf = adaptive_11r_ie; |
| 1757 | |
| 1758 | return QDF_STATUS_SUCCESS; |
| 1759 | } |
| 1760 | |
| 1761 | #else |
| 1762 | static inline |
| 1763 | QDF_STATUS lim_fill_adaptive_11r_ie(struct pe_session *pe_session, |
| 1764 | uint8_t **ie_buf, uint8_t *ie_len) |
| 1765 | { |
| 1766 | return QDF_STATUS_SUCCESS; |
| 1767 | } |
| 1768 | #endif |
| 1769 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1770 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1771 | * lim_send_assoc_req_mgmt_frame() - Send association request |
| 1772 | * @mac_ctx: Handle to MAC context |
| 1773 | * @mlm_assoc_req: Association request information |
| 1774 | * @pe_session: PE session information |
| 1775 | * |
| 1776 | * Builds and transmits association request frame to AP. |
| 1777 | * |
| 1778 | * Return: Void |
| 1779 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1780 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1781 | lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1782 | tLimMlmAssocReq *mlm_assoc_req, |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 1783 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1784 | { |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 1785 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1786 | tDot11fAssocRequest *frm; |
| 1787 | uint16_t caps; |
| 1788 | uint8_t *frame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1789 | QDF_STATUS sir_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1790 | tLimMlmAssocCnf assoc_cnf; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1791 | uint32_t bytes = 0, payload, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1792 | uint8_t qos_enabled, wme_enabled, wsm_enabled; |
| 1793 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1794 | QDF_STATUS qdf_status; |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 1795 | uint16_t add_ie_len, current_len = 0, vendor_ie_len = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1796 | uint8_t *add_ie; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 1797 | const uint8_t *wps_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1798 | uint8_t power_caps = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1799 | uint8_t tx_flag = 0; |
| 1800 | uint8_t sme_sessionid = 0; |
| 1801 | bool vht_enabled = false; |
| 1802 | tDot11fIEExtCap extr_ext_cap; |
| 1803 | bool extr_ext_flag = true; |
| 1804 | tpSirMacMgmtHdr mac_hdr; |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1805 | uint32_t ie_offset = 0; |
| 1806 | uint8_t *p_ext_cap = NULL; |
| 1807 | tDot11fIEExtCap bcn_ext_cap; |
| 1808 | uint8_t *bcn_ie = NULL; |
| 1809 | uint32_t bcn_ie_len = 0; |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 1810 | uint32_t aes_block_size_len = 0; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1811 | enum rateid min_rid = RATEID_DEFAULT; |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 1812 | uint8_t *mbo_ie = NULL, *adaptive_11r_ie = NULL, *vendor_ies = NULL; |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 1813 | uint8_t mbo_ie_len = 0, adaptive_11r_ie_len = 0; |
Srinivas Dasari | 603d497 | 2019-09-20 17:28:44 +0530 | [diff] [blame] | 1814 | struct wlan_objmgr_peer *peer; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1815 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1816 | if (!pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1817 | pe_err("pe_session is NULL"); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1818 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1819 | return; |
| 1820 | } |
| 1821 | |
| 1822 | sme_sessionid = pe_session->smeSessionId; |
| 1823 | |
| 1824 | /* check this early to avoid unncessary operation */ |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1825 | if (!pe_session->lim_join_req) { |
| 1826 | pe_err("pe_session->lim_join_req is NULL"); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1827 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1828 | return; |
| 1829 | } |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1830 | add_ie_len = pe_session->lim_join_req->addIEAssoc.length; |
| 1831 | add_ie = pe_session->lim_join_req->addIEAssoc.addIEdata; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1832 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1833 | frm = qdf_mem_malloc(sizeof(tDot11fAssocRequest)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1834 | if (!frm) { |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1835 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1836 | return; |
| 1837 | } |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1838 | qdf_mem_zero((uint8_t *) frm, sizeof(tDot11fAssocRequest)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1839 | |
Agrawal Ashish | 0f94b57 | 2016-02-22 13:27:06 +0530 | [diff] [blame] | 1840 | if (add_ie_len && pe_session->is_ext_caps_present) { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1841 | qdf_mem_zero((uint8_t *) &extr_ext_cap, |
| 1842 | sizeof(tDot11fIEExtCap)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1843 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 1844 | add_ie, &add_ie_len, &extr_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1845 | if (QDF_STATUS_SUCCESS != sir_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1846 | extr_ext_flag = false; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1847 | pe_debug("Unable to Stripoff ExtCap IE from Assoc Req"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1848 | } else { |
| 1849 | struct s_ext_cap *p_ext_cap = (struct s_ext_cap *) |
| 1850 | extr_ext_cap.bytes; |
| 1851 | |
| 1852 | if (p_ext_cap->interworking_service) |
| 1853 | p_ext_cap->qos_map = 1; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1854 | extr_ext_cap.num_bytes = |
| 1855 | lim_compute_ext_cap_ie_length(&extr_ext_cap); |
| 1856 | extr_ext_flag = (extr_ext_cap.num_bytes > 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1857 | } |
| 1858 | } else { |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 1859 | 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] | 1860 | extr_ext_flag = false; |
| 1861 | } |
| 1862 | |
| 1863 | caps = mlm_assoc_req->capabilityInfo; |
| 1864 | #if defined(FEATURE_WLAN_WAPI) |
| 1865 | /* |
| 1866 | * According to WAPI standard: |
| 1867 | * 7.3.1.4 Capability Information field |
| 1868 | * In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 |
| 1869 | * in transmitted Association or Reassociation management frames. |
| 1870 | * APs ignore the Privacy subfield within received Association and |
| 1871 | * Reassociation management frames. |
| 1872 | */ |
| 1873 | if (pe_session->encryptType == eSIR_ED_WPI) |
| 1874 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 1875 | #endif |
| 1876 | swap_bit_field16(caps, (uint16_t *) &frm->Capabilities); |
| 1877 | |
| 1878 | frm->ListenInterval.interval = mlm_assoc_req->listenInterval; |
| 1879 | populate_dot11f_ssid2(mac_ctx, &frm->SSID); |
| 1880 | populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1881 | &frm->SuppRates, pe_session); |
| 1882 | |
| 1883 | qos_enabled = (pe_session->limQosEnabled) && |
| 1884 | SIR_MAC_GET_QOS(pe_session->limCurrentBssCaps); |
| 1885 | |
| 1886 | wme_enabled = (pe_session->limWmeEnabled) && |
| 1887 | LIM_BSS_CAPS_GET(WME, pe_session->limCurrentBssQosCaps); |
| 1888 | |
| 1889 | /* We prefer .11e asociations: */ |
| 1890 | if (qos_enabled) |
| 1891 | wme_enabled = false; |
| 1892 | |
| 1893 | wsm_enabled = (pe_session->limWsmEnabled) && wme_enabled && |
| 1894 | LIM_BSS_CAPS_GET(WSM, pe_session->limCurrentBssQosCaps); |
| 1895 | |
| 1896 | if (pe_session->lim11hEnable && |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1897 | pe_session->lim_join_req->spectrumMgtIndicator == true) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1898 | power_caps = true; |
| 1899 | |
| 1900 | populate_dot11f_power_caps(mac_ctx, &frm->PowerCaps, |
| 1901 | LIM_ASSOC, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1902 | populate_dot11f_supp_channels(mac_ctx, &frm->SuppChannels, |
| 1903 | LIM_ASSOC, pe_session); |
| 1904 | |
| 1905 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1906 | if (mac_ctx->rrm.rrmPEContext.rrmEnable && |
| 1907 | SIR_MAC_GET_RRM(pe_session->limCurrentBssCaps)) { |
| 1908 | if (power_caps == false) { |
| 1909 | power_caps = true; |
| 1910 | populate_dot11f_power_caps(mac_ctx, &frm->PowerCaps, |
| 1911 | LIM_ASSOC, pe_session); |
| 1912 | } |
| 1913 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1914 | if (qos_enabled) |
Naveen Rawat | cd11831 | 2016-11-22 10:46:21 -0800 | [diff] [blame] | 1915 | populate_dot11f_qos_caps_station(mac_ctx, pe_session, |
| 1916 | &frm->QOSCapsStation); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1917 | |
| 1918 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 1919 | POPULATE_DOT11F_RATES_OPERATIONAL, &frm->ExtSuppRates, |
| 1920 | pe_session); |
| 1921 | |
Gupta, Kapil | 54a1699 | 2016-01-13 19:34:02 +0530 | [diff] [blame] | 1922 | if (mac_ctx->rrm.rrmPEContext.rrmEnable && |
| 1923 | SIR_MAC_GET_RRM(pe_session->limCurrentBssCaps)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1924 | populate_dot11f_rrm_ie(mac_ctx, &frm->RRMEnabledCap, |
| 1925 | pe_session); |
Deepak Dhamdhere | 641bf32 | 2016-01-06 15:19:03 -0800 | [diff] [blame] | 1926 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1927 | /* |
| 1928 | * The join request *should* contain zero or one of the WPA and RSN |
| 1929 | * IEs. The payload send along with the request is a |
Jeff Johnson | 701444f | 2019-02-02 22:35:13 -0800 | [diff] [blame] | 1930 | * 'struct join_req'; the IE portion is held inside a 'tSirRSNie': |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1931 | * typedef struct sSirRSNie |
| 1932 | * { |
| 1933 | * uint16_t length; |
Srinivas Girigowda | cf16140 | 2019-03-14 11:37:33 -0700 | [diff] [blame] | 1934 | * uint8_t rsnIEdata[WLAN_MAX_IE_LEN+2]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1935 | * } tSirRSNie, *tpSirRSNie; |
| 1936 | * So, we should be able to make the following two calls harmlessly, |
| 1937 | * since they do nothing if they don't find the given IE in the |
| 1938 | * bytestream with which they're provided. |
| 1939 | * The net effect of this will be to faithfully transmit whatever |
| 1940 | * security IE is in the join request. |
| 1941 | * However, if we're associating for the purpose of WPS |
| 1942 | * enrollment, and we've been configured to indicate that by |
| 1943 | * eliding the WPA or RSN IE, we just skip this: |
| 1944 | */ |
| 1945 | if (add_ie_len && add_ie) |
| 1946 | wps_ie = limGetWscIEPtr(mac_ctx, add_ie, add_ie_len); |
| 1947 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1948 | if (!wps_ie) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1949 | populate_dot11f_rsn_opaque(mac_ctx, |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1950 | &pe_session->lim_join_req->rsnIE, |
| 1951 | &frm->RSNOpaque); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1952 | populate_dot11f_wpa_opaque(mac_ctx, |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1953 | &pe_session->lim_join_req->rsnIE, |
| 1954 | &frm->WPAOpaque); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1955 | #if defined(FEATURE_WLAN_WAPI) |
| 1956 | populate_dot11f_wapi_opaque(mac_ctx, |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1957 | &(pe_session->lim_join_req->rsnIE), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1958 | &frm->WAPIOpaque); |
| 1959 | #endif /* defined(FEATURE_WLAN_WAPI) */ |
| 1960 | } |
| 1961 | /* include WME EDCA IE as well */ |
| 1962 | if (wme_enabled) { |
| 1963 | populate_dot11f_wmm_info_station_per_session(mac_ctx, |
| 1964 | pe_session, &frm->WMMInfoStation); |
| 1965 | |
| 1966 | if (wsm_enabled) |
| 1967 | populate_dot11f_wmm_caps(&frm->WMMCaps); |
| 1968 | } |
| 1969 | |
| 1970 | /* |
| 1971 | * Populate HT IEs, when operating in 11n and |
| 1972 | * when AP is also operating in 11n mode |
| 1973 | */ |
| 1974 | if (pe_session->htCapability && |
| 1975 | mac_ctx->lim.htCapabilityPresentInBeacon) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1976 | pe_debug("Populate HT Caps in Assoc Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1977 | populate_dot11f_ht_caps(mac_ctx, pe_session, &frm->HTCaps); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 1978 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 1979 | &frm->HTCaps, sizeof(frm->HTCaps)); |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 1980 | } else if (pe_session->he_with_wep_tkip) { |
| 1981 | pe_debug("Populate HT Caps in Assoc Request with WEP/TKIP"); |
| 1982 | populate_dot11f_ht_caps(mac_ctx, NULL, &frm->HTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1983 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1984 | 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] | 1985 | frm->HTCaps.supportedChannelWidthSet, |
| 1986 | frm->HTCaps.mimoPowerSave, |
| 1987 | frm->HTCaps.greenField, frm->HTCaps.shortGI20MHz, |
| 1988 | frm->HTCaps.shortGI40MHz, |
| 1989 | frm->HTCaps.dsssCckMode40MHz, |
| 1990 | frm->HTCaps.maxRxAMPDUFactor); |
| 1991 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1992 | if (pe_session->vhtCapability && |
| 1993 | pe_session->vhtCapabilityPresentInBeacon) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1994 | pe_debug("Populate VHT IEs in Assoc Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1995 | populate_dot11f_vht_caps(mac_ctx, pe_session, &frm->VHTCaps); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 1996 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 1997 | &frm->VHTCaps, sizeof(frm->VHTCaps)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1998 | vht_enabled = true; |
Kiran Kumar Lokere | 1d4094e | 2016-08-31 19:04:04 -0700 | [diff] [blame] | 1999 | if (pe_session->enableHtSmps && |
| 2000 | !pe_session->supported_nss_1x1) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2001 | pe_err("VHT OP mode IE in Assoc Req"); |
Kiran Kumar Lokere | 1d4094e | 2016-08-31 19:04:04 -0700 | [diff] [blame] | 2002 | populate_dot11f_operating_mode(mac_ctx, |
| 2003 | &frm->OperatingMode, pe_session); |
| 2004 | } |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 2005 | } else if (pe_session->he_with_wep_tkip) { |
| 2006 | pe_debug("Populate VHT IEs in Assoc Request with WEP/TKIP"); |
| 2007 | populate_dot11f_vht_caps(mac_ctx, NULL, &frm->VHTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2008 | } |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 2009 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2010 | if (!vht_enabled && |
| 2011 | pe_session->is_vendor_specific_vhtcaps) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2012 | pe_debug("Populate Vendor VHT IEs in Assoc Request"); |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 2013 | frm->vendor_vht_ie.present = 1; |
Kiran Kumar Lokere | 8172263 | 2017-09-26 12:11:43 -0700 | [diff] [blame] | 2014 | frm->vendor_vht_ie.sub_type = |
| 2015 | pe_session->vendor_specific_vht_ie_sub_type; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 2016 | frm->vendor_vht_ie.VHTCaps.present = 1; |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 2017 | if (!mac_ctx->mlme_cfg->vht_caps.vht_cap_info.vendor_vhtie && |
Abhishek Singh | 6884428 | 2018-01-25 16:48:41 +0530 | [diff] [blame] | 2018 | pe_session->vht_config.su_beam_formee) { |
| 2019 | pe_debug("Disable SU beamformee for vendor IE"); |
| 2020 | pe_session->vht_config.su_beam_formee = 0; |
| 2021 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2022 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 2023 | &frm->vendor_vht_ie.VHTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2024 | vht_enabled = true; |
| 2025 | } |
Agrawal Ashish | 0f94b57 | 2016-02-22 13:27:06 +0530 | [diff] [blame] | 2026 | if (pe_session->is_ext_caps_present) |
| 2027 | populate_dot11f_ext_cap(mac_ctx, vht_enabled, |
| 2028 | &frm->ExtCap, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2029 | |
Kiran Kumar Lokere | 89f01f0 | 2019-08-06 18:22:39 -0700 | [diff] [blame] | 2030 | populate_dot11f_qcn_ie(mac_ctx, &frm->qcn_ie, QCN_IE_ATTR_ID_ALL); |
Selvaraj, Sridhar | a521aab | 2017-03-25 16:42:34 +0530 | [diff] [blame] | 2031 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2032 | if (lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 2033 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2034 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 2035 | &frm->he_cap); |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 2036 | } else if (pe_session->he_with_wep_tkip) { |
| 2037 | pe_debug("Populate HE IEs in Assoc Request with WEP/TKIP"); |
| 2038 | populate_dot11f_he_caps(mac_ctx, NULL, &frm->he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2039 | } |
Selvaraj, Sridhar | c2fe7a3 | 2017-02-02 19:20:16 +0530 | [diff] [blame] | 2040 | |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2041 | if (pe_session->lim_join_req->is11Rconnection) { |
Pragaspathi Thilagaraj | 1112c96 | 2019-05-23 23:45:38 +0530 | [diff] [blame] | 2042 | struct bss_description *bssdescr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2043 | |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2044 | bssdescr = &pe_session->lim_join_req->bssDescription; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2045 | pe_debug("mdie = %02x %02x %02x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2046 | (unsigned int) bssdescr->mdie[0], |
| 2047 | (unsigned int) bssdescr->mdie[1], |
| 2048 | (unsigned int) bssdescr->mdie[2]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2049 | populate_mdie(mac_ctx, &frm->MobilityDomain, |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2050 | pe_session->lim_join_req->bssDescription.mdie); |
Pragaspathi Thilagaraj | 03839b9 | 2019-03-12 17:45:21 +0530 | [diff] [blame] | 2051 | |
| 2052 | /* |
| 2053 | * IEEE80211-ai [13.2.4 FT initial mobility domain association |
| 2054 | * over FILS in an RSN] |
| 2055 | * Populate FT IE in association request. This FT IE should be |
| 2056 | * same as the FT IE received in auth response frame during the |
| 2057 | * FT-FILS authentication. |
| 2058 | */ |
| 2059 | if (lim_is_fils_connection(pe_session)) |
| 2060 | populate_fils_ft_info(mac_ctx, &frm->FTInfo, |
| 2061 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2062 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2063 | |
| 2064 | #ifdef FEATURE_WLAN_ESE |
| 2065 | /* |
| 2066 | * ESE Version IE will be included in association request |
| 2067 | * when ESE is enabled on DUT through ini and it is also |
| 2068 | * advertised by the peer AP to which we are trying to |
| 2069 | * associate to. |
| 2070 | */ |
| 2071 | if (pe_session->is_ese_version_ie_present && |
Wu Gao | 51a6356 | 2018-11-08 16:29:10 +0800 | [diff] [blame] | 2072 | mac_ctx->mlme_cfg->lfr.ese_enabled) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2073 | populate_dot11f_ese_version(&frm->ESEVersion); |
| 2074 | /* For ESE Associations fill the ESE IEs */ |
| 2075 | if (pe_session->isESEconnection && |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2076 | pe_session->lim_join_req->isESEFeatureIniEnabled) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2077 | #ifndef FEATURE_DISABLE_RM |
| 2078 | populate_dot11f_ese_rad_mgmt_cap(&frm->ESERadMgmtCap); |
| 2079 | #endif |
| 2080 | } |
| 2081 | #endif |
| 2082 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 2083 | /* |
| 2084 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 2085 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 2086 | * dot11f get packed payload size. |
| 2087 | */ |
| 2088 | if (extr_ext_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 2089 | lim_merge_extcap_struct(&frm->ExtCap, &extr_ext_cap, true); |
| 2090 | |
| 2091 | /* Clear the bits in EXTCAP IE if AP not advertise it in beacon */ |
| 2092 | if (frm->ExtCap.present && pe_session->is_ext_caps_present) { |
| 2093 | ie_offset = DOT11F_FF_TIMESTAMP_LEN + |
| 2094 | DOT11F_FF_BEACONINTERVAL_LEN + |
| 2095 | DOT11F_FF_CAPABILITIES_LEN; |
| 2096 | |
| 2097 | qdf_mem_zero((uint8_t *)&bcn_ext_cap, sizeof(tDot11fIEExtCap)); |
| 2098 | if (pe_session->beacon && pe_session->bcnLen > ie_offset) { |
| 2099 | bcn_ie = pe_session->beacon + ie_offset; |
| 2100 | bcn_ie_len = pe_session->bcnLen - ie_offset; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 2101 | p_ext_cap = (uint8_t *)wlan_get_ie_ptr_from_eid( |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 2102 | DOT11F_EID_EXTCAP, |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 2103 | bcn_ie, bcn_ie_len); |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 2104 | lim_update_extcap_struct(mac_ctx, p_ext_cap, |
| 2105 | &bcn_ext_cap); |
| 2106 | lim_merge_extcap_struct(&frm->ExtCap, &bcn_ext_cap, |
| 2107 | false); |
| 2108 | } |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 2109 | /* |
| 2110 | * TWT extended capabilities should be populated after the |
| 2111 | * intersection of beacon caps and self caps is done because |
| 2112 | * the bits for TWT are unique to STA and AP and cannot be |
| 2113 | * intersected. |
| 2114 | */ |
| 2115 | populate_dot11f_twt_extended_caps(mac_ctx, pe_session, |
| 2116 | &frm->ExtCap); |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 2117 | } |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 2118 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2119 | 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] | 2120 | add_ie, &add_ie_len, &frm->SuppOperatingClasses)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2121 | pe_debug("Unable to Stripoff supp op classes IE from Assoc Req"); |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 2122 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2123 | if (lim_is_fils_connection(pe_session)) { |
| 2124 | populate_dot11f_fils_params(mac_ctx, frm, pe_session); |
| 2125 | aes_block_size_len = AES_BLOCK_SIZE; |
| 2126 | } |
| 2127 | |
| 2128 | /* |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2129 | * MBO IE needs to be appendded at the end of the assoc request |
| 2130 | * frame and is not parsed and unpacked by the frame parser |
| 2131 | * as the supplicant can send multiple TLVs with same Attribute |
| 2132 | * in the MBO IE and the frame parser does not support multiple |
| 2133 | * TLVs with same attribute in a single IE. |
| 2134 | * Strip off the MBO IE from add_ie and append it at the end. |
| 2135 | */ |
| 2136 | if (wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_MBO_OUI, |
| 2137 | SIR_MAC_MBO_OUI_SIZE, add_ie, add_ie_len)) { |
| 2138 | mbo_ie = qdf_mem_malloc(DOT11F_IE_MBO_IE_MAX_LEN + 2); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2139 | if (!mbo_ie) |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2140 | goto end; |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2141 | |
| 2142 | qdf_status = lim_strip_ie(mac_ctx, add_ie, &add_ie_len, |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 2143 | WLAN_ELEMID_VENDOR, ONE_BYTE, |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2144 | SIR_MAC_MBO_OUI, |
| 2145 | SIR_MAC_MBO_OUI_SIZE, |
| 2146 | mbo_ie, DOT11F_IE_MBO_IE_MAX_LEN); |
| 2147 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2148 | pe_err("Failed to strip MBO IE"); |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 2149 | goto end; |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2150 | } |
| 2151 | |
| 2152 | /* Include the EID and length fields */ |
| 2153 | mbo_ie_len = mbo_ie[1] + 2; |
| 2154 | pe_debug("Stripped MBO IE of length %d", mbo_ie_len); |
Srinivas Dasari | 603d497 | 2019-09-20 17:28:44 +0530 | [diff] [blame] | 2155 | |
| 2156 | peer = wlan_objmgr_get_peer_by_mac(mac_ctx->psoc, |
| 2157 | mlm_assoc_req->peerMacAddr, |
| 2158 | WLAN_MBO_ID); |
| 2159 | if (peer && !mlme_get_peer_pmf_status(peer)) { |
| 2160 | pe_debug("Peer doesn't support PMF, Don't add MBO IE"); |
| 2161 | qdf_mem_free(mbo_ie); |
| 2162 | mbo_ie = NULL; |
| 2163 | mbo_ie_len = 0; |
| 2164 | } |
| 2165 | if (peer) |
| 2166 | wlan_objmgr_peer_release_ref(peer, WLAN_MBO_ID); |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2167 | } |
| 2168 | |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 2169 | /* |
| 2170 | * Strip rest of the vendor IEs and append to the assoc request frame. |
| 2171 | * Append the IEs just before MBO IEs as MBO IEs have to be at the |
| 2172 | * end of the frame. |
| 2173 | */ |
| 2174 | if (wlan_get_ie_ptr_from_eid(WLAN_ELEMID_VENDOR, add_ie, add_ie_len)) { |
| 2175 | vendor_ies = qdf_mem_malloc(MAX_VENDOR_IES_LEN + 2); |
| 2176 | if (vendor_ies) { |
| 2177 | current_len = add_ie_len; |
| 2178 | qdf_status = lim_strip_ie(mac_ctx, add_ie, &add_ie_len, |
| 2179 | WLAN_ELEMID_VENDOR, ONE_BYTE, |
| 2180 | NULL, |
| 2181 | 0, |
| 2182 | vendor_ies, |
| 2183 | MAX_VENDOR_IES_LEN); |
| 2184 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2185 | pe_err("Failed to strip Vendor IEs"); |
| 2186 | goto end; |
| 2187 | } |
| 2188 | |
| 2189 | vendor_ie_len = current_len - add_ie_len; |
| 2190 | pe_debug("Stripped vendor IEs of size: %u", |
| 2191 | current_len); |
| 2192 | } |
| 2193 | } |
| 2194 | |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 2195 | qdf_status = lim_fill_adaptive_11r_ie(pe_session, &adaptive_11r_ie, |
| 2196 | &adaptive_11r_ie_len); |
| 2197 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2198 | pe_err("Failed to fill adaptive 11r IE"); |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 2199 | goto end; |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 2200 | } |
| 2201 | |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2202 | /* |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2203 | * Do unpack to populate the add_ie buffer to frm structure |
| 2204 | * before packing the frm structure. In this way, the IE ordering |
| 2205 | * which the latest 802.11 spec mandates is maintained. |
| 2206 | */ |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 2207 | if (add_ie_len) { |
| 2208 | ret = dot11f_unpack_assoc_request(mac_ctx, add_ie, |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2209 | add_ie_len, frm, true); |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 2210 | if (DOT11F_FAILED(ret)) { |
| 2211 | pe_err("unpack failed, ret: 0x%x", ret); |
| 2212 | goto end; |
| 2213 | } |
| 2214 | } |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2215 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2216 | status = dot11f_get_packed_assoc_request_size(mac_ctx, frm, &payload); |
| 2217 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2218 | pe_err("Association Request packet size failure(0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2219 | status); |
| 2220 | /* We'll fall back on the worst case scenario: */ |
| 2221 | payload = sizeof(tDot11fAssocRequest); |
| 2222 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2223 | pe_warn("Association request packet size warning (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2224 | status); |
| 2225 | } |
| 2226 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2227 | bytes = payload + sizeof(tSirMacMgmtHdr) + |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 2228 | aes_block_size_len + mbo_ie_len + adaptive_11r_ie_len + |
| 2229 | vendor_ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2230 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2231 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2232 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2233 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2234 | pe_err("Failed to allocate %d bytes", bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2235 | |
| 2236 | pe_session->limMlmState = pe_session->limPrevMlmState; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2237 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_MLM_STATE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2238 | pe_session->peSessionId, |
| 2239 | pe_session->limMlmState)); |
| 2240 | |
| 2241 | /* Update PE session id */ |
| 2242 | assoc_cnf.sessionId = pe_session->peSessionId; |
| 2243 | |
| 2244 | assoc_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2245 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2246 | lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_CNF, |
| 2247 | (uint32_t *) &assoc_cnf); |
| 2248 | |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2249 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2250 | } |
| 2251 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 2252 | qdf_mem_zero(frame, bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2253 | |
| 2254 | /* Next, we fill out the buffer descriptor: */ |
| 2255 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 2256 | SIR_MAC_MGMT_ASSOC_REQ, pe_session->bssId, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 2257 | pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2258 | /* That done, pack the Assoc Request: */ |
| 2259 | status = dot11f_pack_assoc_request(mac_ctx, frm, |
| 2260 | frame + sizeof(tSirMacMgmtHdr), payload, &payload); |
| 2261 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2262 | pe_err("Assoc request pack failure (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2263 | cds_packet_free((void *)packet); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2264 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2265 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2266 | pe_warn("Assoc request pack warning (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2267 | } |
| 2268 | |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 2269 | /* Copy the vendor IEs to the end of the frame */ |
| 2270 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
| 2271 | vendor_ies, vendor_ie_len); |
| 2272 | payload = payload + vendor_ie_len; |
| 2273 | |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2274 | /* Copy the MBO IE to the end of the frame */ |
| 2275 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
| 2276 | mbo_ie, mbo_ie_len); |
| 2277 | payload = payload + mbo_ie_len; |
| 2278 | |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 2279 | /* |
| 2280 | * Copy the Vendor specific Adaptive 11r IE to end of the |
| 2281 | * assoc request frame |
| 2282 | */ |
| 2283 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
| 2284 | adaptive_11r_ie, adaptive_11r_ie_len); |
| 2285 | payload = payload + adaptive_11r_ie_len; |
| 2286 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2287 | if (pe_session->assocReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2288 | qdf_mem_free(pe_session->assocReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2289 | pe_session->assocReq = NULL; |
Naveen Rawat | 83102ef | 2015-11-03 10:42:34 -0800 | [diff] [blame] | 2290 | pe_session->assocReqLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2291 | } |
| 2292 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2293 | if (lim_is_fils_connection(pe_session)) { |
| 2294 | qdf_status = aead_encrypt_assoc_req(mac_ctx, pe_session, |
| 2295 | frame, &payload); |
| 2296 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 2297 | cds_packet_free((void *)packet); |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 2298 | goto end; |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2299 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2300 | } |
| 2301 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2302 | pe_session->assocReq = qdf_mem_malloc(payload); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2303 | if (pe_session->assocReq) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2304 | /* |
| 2305 | * Store the Assoc request. This is sent to csr/hdd in |
| 2306 | * join cnf response. |
| 2307 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2308 | qdf_mem_copy(pe_session->assocReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2309 | frame + sizeof(tSirMacMgmtHdr), payload); |
| 2310 | pe_session->assocReqLen = payload; |
| 2311 | } |
| 2312 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 2313 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 2314 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 2315 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2316 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2317 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 2318 | if (pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 2319 | pe_session->opmode == QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2320 | tx_flag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2321 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2322 | mac_hdr = (tpSirMacMgmtHdr) frame; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2323 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2324 | pe_session->peSessionId, mac_hdr->fc.subType)); |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2325 | |
| 2326 | pe_debug("Sending Association Request length %d to ", bytes); |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2327 | min_rid = lim_get_min_session_txrate(pe_session); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2328 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_START_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2329 | pe_session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2330 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2331 | pe_session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2332 | qdf_status = |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2333 | wma_tx_frameWithTxComplete(mac_ctx, packet, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2334 | (uint16_t) (sizeof(tSirMacMgmtHdr) + payload), |
| 2335 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2336 | lim_tx_complete, frame, lim_assoc_tx_complete_cnf, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2337 | tx_flag, sme_sessionid, false, 0, min_rid); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2338 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2339 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2340 | pe_session->peSessionId, qdf_status)); |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2341 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2342 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2343 | pe_err("Failed to send Association Request (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2344 | qdf_status); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2345 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2346 | pe_session, SENT_FAIL, QDF_STATUS_E_FAILURE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2347 | /* Pkt will be freed up by the callback */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2348 | } |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2349 | |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2350 | end: |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 2351 | qdf_mem_free(vendor_ies); |
| 2352 | qdf_mem_free(mbo_ie); |
| 2353 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2354 | /* Free up buffer allocated for mlm_assoc_req */ |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 2355 | qdf_mem_free(adaptive_11r_ie); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2356 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2357 | mlm_assoc_req = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2358 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2359 | return; |
| 2360 | } |
| 2361 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2362 | /** |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 2363 | * lim_addba_rsp_tx_complete_cnf() - Confirmation for add BA response OTA |
| 2364 | * @context: pointer to global mac |
| 2365 | * @buf: buffer which is nothing but entire ADD BA frame |
| 2366 | * @tx_complete : Sent status |
| 2367 | * @params; tx completion params |
| 2368 | * |
| 2369 | * Return: This returns QDF_STATUS |
| 2370 | */ |
| 2371 | static QDF_STATUS lim_addba_rsp_tx_complete_cnf(void *context, |
| 2372 | qdf_nbuf_t buf, |
| 2373 | uint32_t tx_complete, |
| 2374 | void *params) |
| 2375 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2376 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 2377 | tSirMacMgmtHdr *mac_hdr; |
| 2378 | tDot11faddba_rsp rsp; |
| 2379 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 2380 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 2381 | uint8_t peer_id; |
| 2382 | void *peer; |
| 2383 | uint32_t frame_len; |
| 2384 | QDF_STATUS status; |
| 2385 | uint8_t *data; |
| 2386 | |
| 2387 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) |
| 2388 | pe_debug("Add ba response successfully sent"); |
| 2389 | else |
| 2390 | pe_debug("Fail to send add ba response"); |
| 2391 | |
| 2392 | if (!buf) { |
| 2393 | pe_err("Addba response frame buffer is NULL"); |
| 2394 | return QDF_STATUS_E_FAILURE; |
| 2395 | } |
| 2396 | |
| 2397 | data = qdf_nbuf_data(buf); |
| 2398 | |
| 2399 | if (!data) { |
| 2400 | pe_err("Addba response frame is NULL"); |
| 2401 | return QDF_STATUS_E_FAILURE; |
| 2402 | } |
| 2403 | |
| 2404 | mac_hdr = (tSirMacMgmtHdr *)data; |
| 2405 | qdf_mem_zero((void *)&rsp, sizeof(tDot11faddba_rsp)); |
| 2406 | frame_len = sizeof(rsp); |
| 2407 | status = dot11f_unpack_addba_rsp(mac_ctx, (uint8_t *)data + |
| 2408 | sizeof(*mac_hdr), frame_len, |
| 2409 | &rsp, false); |
| 2410 | |
| 2411 | if (DOT11F_FAILED(status)) { |
| 2412 | pe_err("Failed to unpack and parse (0x%08x, %d bytes)", |
| 2413 | status, frame_len); |
| 2414 | goto error; |
| 2415 | } |
| 2416 | |
| 2417 | peer = cdp_peer_get_ref_by_addr(soc, pdev, mac_hdr->da, &peer_id, |
| 2418 | PEER_DEBUG_ID_WMA_ADDBA_REQ); |
| 2419 | if (!peer) { |
| 2420 | pe_debug("no PEER found for mac_addr:%pM", mac_hdr->da); |
| 2421 | goto error; |
| 2422 | } |
| 2423 | cdp_addba_resp_tx_completion(soc, peer, rsp.addba_param_set.tid, |
| 2424 | tx_complete); |
| 2425 | cdp_peer_release_ref(soc, peer, PEER_DEBUG_ID_WMA_ADDBA_REQ); |
| 2426 | error: |
| 2427 | if (buf) |
| 2428 | qdf_nbuf_free(buf); |
| 2429 | |
| 2430 | return QDF_STATUS_SUCCESS; |
| 2431 | } |
| 2432 | |
| 2433 | /** |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2434 | * lim_auth_tx_complete_cnf()- Confirmation for auth sent over the air |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2435 | * @context: pointer to global mac |
| 2436 | * @buf: buffer |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2437 | * @tx_complete : Sent status |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2438 | * @params; tx completion params |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2439 | * |
| 2440 | * Return: This returns QDF_STATUS |
| 2441 | */ |
| 2442 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2443 | static QDF_STATUS lim_auth_tx_complete_cnf(void *context, |
| 2444 | qdf_nbuf_t buf, |
| 2445 | uint32_t tx_complete, |
| 2446 | void *params) |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2447 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2448 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2449 | uint16_t auth_ack_status; |
| 2450 | uint16_t reason_code; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2451 | |
Naveen Rawat | 684e8b1 | 2017-09-20 15:54:44 -0700 | [diff] [blame] | 2452 | pe_debug("tx_complete = %d %s", tx_complete, |
Zhu Jianmin | 5d8e3fe | 2018-01-04 16:16:20 +0800 | [diff] [blame] | 2453 | (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) ? |
| 2454 | "success" : "fail"); |
| 2455 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) { |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2456 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_SUCCESS; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2457 | auth_ack_status = ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2458 | reason_code = QDF_STATUS_SUCCESS; |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2459 | /* 'Change' timer for future activations */ |
| 2460 | lim_deactivate_and_change_timer(mac_ctx, eLIM_AUTH_RETRY_TIMER); |
| 2461 | } else { |
| 2462 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2463 | auth_ack_status = NOT_ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2464 | reason_code = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2465 | } |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2466 | |
| 2467 | if (buf) |
| 2468 | qdf_nbuf_free(buf); |
| 2469 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2470 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
| 2471 | NULL, auth_ack_status, reason_code); |
| 2472 | |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2473 | return QDF_STATUS_SUCCESS; |
| 2474 | } |
| 2475 | |
| 2476 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2477 | * lim_send_auth_mgmt_frame() - Send an Authentication frame |
| 2478 | * |
| 2479 | * @mac_ctx: Pointer to Global MAC structure |
| 2480 | * @auth_frame: Pointer to Authentication frame structure |
| 2481 | * @peer_addr: MAC address of destination peer |
| 2482 | * @wep_bit: wep bit in frame control for Authentication frame3 |
| 2483 | * @session: PE session information |
| 2484 | * |
| 2485 | * This function is called by lim_process_mlm_messages(). Authentication frame |
| 2486 | * is formatted and sent when this function is called. |
| 2487 | * |
| 2488 | * Return: void |
| 2489 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2490 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2491 | lim_send_auth_mgmt_frame(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2492 | tpSirMacAuthFrameBody auth_frame, |
| 2493 | tSirMacAddr peer_addr, |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2494 | uint8_t wep_challenge_len, |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 2495 | struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2496 | { |
| 2497 | uint8_t *frame, *body; |
| 2498 | uint32_t frame_len = 0, body_len = 0; |
| 2499 | tpSirMacMgmtHdr mac_hdr; |
| 2500 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2501 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2502 | uint8_t tx_flag = 0; |
| 2503 | uint8_t sme_sessionid = 0; |
| 2504 | uint16_t ft_ies_length = 0; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2505 | bool challenge_req = false; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2506 | enum rateid min_rid = RATEID_DEFAULT; |
Rajasekaran Kalidoss | 7152a35 | 2018-11-19 09:58:35 +0530 | [diff] [blame] | 2507 | uint16_t ch_freq_tx_frame = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2508 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2509 | if (!session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2510 | pe_err("Error: psession Entry is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2511 | return; |
| 2512 | } |
| 2513 | |
| 2514 | sme_sessionid = session->smeSessionId; |
| 2515 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2516 | if (wep_challenge_len) { |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2517 | /* |
| 2518 | * Auth frame3 to be sent with encrypted framebody |
| 2519 | * |
| 2520 | * Allocate buffer for Authenticaton frame of size |
| 2521 | * equal to management frame header length plus 2 bytes |
| 2522 | * each for auth algorithm number, transaction number, |
| 2523 | * status code, 128 bytes for challenge text and |
| 2524 | * 4 bytes each for IV & ICV. |
| 2525 | */ |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2526 | pe_debug("Sending encrypted auth frame to " QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2527 | QDF_MAC_ADDR_ARRAY(peer_addr)); |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2528 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2529 | body_len = wep_challenge_len + LIM_ENCR_AUTH_INFO_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2530 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2531 | |
| 2532 | goto alloc_packet; |
| 2533 | } |
| 2534 | |
Tushnim Bhattacharyya | 332b74c | 2018-08-10 10:55:51 -0700 | [diff] [blame] | 2535 | pe_debug("Sending Auth seq# %d status %d (%d) to " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2536 | QDF_MAC_ADDR_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2537 | auth_frame->authTransactionSeqNumber, |
| 2538 | auth_frame->authStatusCode, |
| 2539 | (auth_frame->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2540 | QDF_MAC_ADDR_ARRAY(peer_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2541 | |
| 2542 | switch (auth_frame->authTransactionSeqNumber) { |
| 2543 | case SIR_MAC_AUTH_FRAME_1: |
| 2544 | /* |
| 2545 | * Allocate buffer for Authenticaton frame of size |
| 2546 | * equal to management frame header length plus 2 bytes |
| 2547 | * each for auth algorithm number, transaction number |
| 2548 | * and status code. |
| 2549 | */ |
| 2550 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2551 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2552 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2553 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2554 | frame_len += lim_create_fils_auth_data(mac_ctx, |
| 2555 | auth_frame, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2556 | if (auth_frame->authAlgoNumber == eSIR_FT_AUTH) { |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2557 | if (session->ftPEContext.pFTPreAuthReq && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2558 | 0 != session->ftPEContext.pFTPreAuthReq-> |
| 2559 | ft_ies_length) { |
| 2560 | ft_ies_length = session->ftPEContext. |
| 2561 | pFTPreAuthReq->ft_ies_length; |
| 2562 | frame_len += ft_ies_length; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2563 | pe_debug("Auth frame, FTIES length added=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2564 | ft_ies_length); |
| 2565 | } else { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2566 | pe_debug("Auth frame, Does not contain FTIES!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2567 | frame_len += (2 + SIR_MDIE_SIZE); |
| 2568 | } |
| 2569 | } |
Pragaspathi Thilagaraj | 239883a | 2019-03-08 00:33:50 +0530 | [diff] [blame] | 2570 | |
| 2571 | /* include MDIE in FILS authentication frame */ |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2572 | if (session->lim_join_req && |
| 2573 | session->lim_join_req->is11Rconnection && |
Pragaspathi Thilagaraj | 239883a | 2019-03-08 00:33:50 +0530 | [diff] [blame] | 2574 | auth_frame->authAlgoNumber == SIR_FILS_SK_WITHOUT_PFS && |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2575 | session->lim_join_req->bssDescription.mdiePresent) |
Pragaspathi Thilagaraj | 239883a | 2019-03-08 00:33:50 +0530 | [diff] [blame] | 2576 | frame_len += (2 + SIR_MDIE_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2577 | break; |
| 2578 | |
| 2579 | case SIR_MAC_AUTH_FRAME_2: |
| 2580 | if ((auth_frame->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 2581 | ((auth_frame->authAlgoNumber == eSIR_SHARED_KEY) && |
| 2582 | (auth_frame->authStatusCode != |
| 2583 | eSIR_MAC_SUCCESS_STATUS))) { |
| 2584 | /* |
| 2585 | * Allocate buffer for Authenticaton frame of size |
| 2586 | * equal to management frame header length plus |
| 2587 | * 2 bytes each for auth algorithm number, |
| 2588 | * transaction number and status code. |
| 2589 | */ |
| 2590 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2591 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2592 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2593 | } else { |
| 2594 | /* |
| 2595 | * Shared Key algorithm with challenge text |
| 2596 | * to be sent. |
| 2597 | * |
| 2598 | * Allocate buffer for Authenticaton frame of size |
| 2599 | * equal to management frame header length plus |
| 2600 | * 2 bytes each for auth algorithm number, |
| 2601 | * transaction number, status code and 128 bytes |
| 2602 | * for challenge text. |
| 2603 | */ |
| 2604 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2605 | challenge_req = true; |
| 2606 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN + |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2607 | SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH + |
| 2608 | SIR_MAC_CHALLENGE_ID_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2609 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2610 | } |
| 2611 | break; |
| 2612 | |
| 2613 | case SIR_MAC_AUTH_FRAME_3: |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2614 | /* |
| 2615 | * Auth frame3 to be sent without encrypted framebody |
| 2616 | * |
| 2617 | * Allocate buffer for Authenticaton frame of size equal |
| 2618 | * to management frame header length plus 2 bytes each |
| 2619 | * for auth algorithm number, transaction number and |
| 2620 | * status code. |
| 2621 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2622 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2623 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2624 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2625 | break; |
| 2626 | |
| 2627 | case SIR_MAC_AUTH_FRAME_4: |
| 2628 | /* |
| 2629 | * Allocate buffer for Authenticaton frame of size equal |
| 2630 | * to management frame header length plus 2 bytes each |
| 2631 | * for auth algorithm number, transaction number and |
| 2632 | * status code. |
| 2633 | */ |
| 2634 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2635 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2636 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2637 | |
| 2638 | break; |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2639 | default: |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2640 | pe_err("Invalid auth transaction seq num"); |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2641 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2642 | } /* switch (auth_frame->authTransactionSeqNumber) */ |
| 2643 | |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2644 | alloc_packet: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2645 | qdf_status = cds_packet_alloc((uint16_t) frame_len, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2646 | (void **)&packet); |
| 2647 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2648 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2649 | pe_err("call to bufAlloc failed for AUTH frame"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2650 | return; |
| 2651 | } |
| 2652 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2653 | qdf_mem_zero(frame, frame_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2654 | |
| 2655 | /* Prepare BD */ |
| 2656 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 2657 | SIR_MAC_MGMT_AUTH, peer_addr, session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2658 | mac_hdr = (tpSirMacMgmtHdr) frame; |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2659 | if (wep_challenge_len) |
| 2660 | mac_hdr->fc.wep = LIM_WEP_IN_FC; |
| 2661 | else |
| 2662 | mac_hdr->fc.wep = LIM_NO_WEP_IN_FC; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2663 | |
| 2664 | /* Prepare BSSId */ |
Rajeev Kumar | cf835a0 | 2016-04-15 15:01:31 -0700 | [diff] [blame] | 2665 | if (LIM_IS_AP_ROLE(session)) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2666 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2667 | (uint8_t *) session->bssId, |
| 2668 | sizeof(tSirMacAddr)); |
| 2669 | |
| 2670 | /* Prepare Authentication frame body */ |
| 2671 | body = frame + sizeof(tSirMacMgmtHdr); |
| 2672 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2673 | if (wep_challenge_len) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2674 | qdf_mem_copy(body, (uint8_t *) auth_frame, body_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2675 | |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2676 | pe_debug("Sending Auth seq# 3 to " QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2677 | QDF_MAC_ADDR_ARRAY(mac_hdr->da)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2678 | |
| 2679 | } else { |
| 2680 | *((uint16_t *) (body)) = |
| 2681 | sir_swap_u16if_needed(auth_frame->authAlgoNumber); |
| 2682 | body += sizeof(uint16_t); |
| 2683 | body_len -= sizeof(uint16_t); |
| 2684 | |
| 2685 | *((uint16_t *) (body)) = |
| 2686 | sir_swap_u16if_needed( |
| 2687 | auth_frame->authTransactionSeqNumber); |
| 2688 | body += sizeof(uint16_t); |
| 2689 | body_len -= sizeof(uint16_t); |
| 2690 | |
| 2691 | *((uint16_t *) (body)) = |
| 2692 | sir_swap_u16if_needed(auth_frame->authStatusCode); |
| 2693 | body += sizeof(uint16_t); |
| 2694 | body_len -= sizeof(uint16_t); |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2695 | |
| 2696 | if (challenge_req) { |
| 2697 | if (body_len < SIR_MAC_AUTH_CHALLENGE_BODY_LEN) { |
Himanshu Agarwal | c422ca7 | 2017-09-19 11:07:36 +0530 | [diff] [blame] | 2698 | /* copy challenge IE id, len, challenge text */ |
| 2699 | *body = auth_frame->type; |
| 2700 | body++; |
| 2701 | body_len -= sizeof(uint8_t); |
| 2702 | *body = auth_frame->length; |
| 2703 | body++; |
| 2704 | body_len -= sizeof(uint8_t); |
| 2705 | qdf_mem_copy(body, auth_frame->challengeText, |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2706 | body_len); |
| 2707 | pe_err("Incomplete challenge info: length: %d, expected: %d", |
| 2708 | body_len, |
| 2709 | SIR_MAC_AUTH_CHALLENGE_BODY_LEN); |
| 2710 | body += body_len; |
| 2711 | body_len = 0; |
| 2712 | } else { |
| 2713 | /* copy challenge IE id, len, challenge text */ |
| 2714 | *body = auth_frame->type; |
| 2715 | body++; |
| 2716 | *body = auth_frame->length; |
| 2717 | body++; |
| 2718 | qdf_mem_copy(body, auth_frame->challengeText, |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2719 | SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH); |
| 2720 | body += SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2721 | |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2722 | body_len -= SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH + |
| 2723 | SIR_MAC_CHALLENGE_ID_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2724 | } |
| 2725 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2726 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2727 | if ((auth_frame->authAlgoNumber == eSIR_FT_AUTH) && |
| 2728 | (auth_frame->authTransactionSeqNumber == |
| 2729 | SIR_MAC_AUTH_FRAME_1) && |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2730 | (session->ftPEContext.pFTPreAuthReq)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2731 | |
| 2732 | if (ft_ies_length > 0) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2733 | qdf_mem_copy(body, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2734 | session->ftPEContext. |
| 2735 | pFTPreAuthReq->ft_ies, |
| 2736 | ft_ies_length); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2737 | pe_debug("Auth1 Frame FTIE is: "); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2738 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, |
| 2739 | QDF_TRACE_LEVEL_DEBUG, |
| 2740 | (uint8_t *) body, |
| 2741 | ft_ies_length); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2742 | } else if (session->ftPEContext. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2743 | pFTPreAuthReq->pbssDescription) { |
| 2744 | /* MDID attr is 54 */ |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 2745 | *body = WLAN_ELEMID_MOBILITY_DOMAIN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2746 | body++; |
| 2747 | *body = SIR_MDIE_SIZE; |
| 2748 | body++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2749 | qdf_mem_copy(body, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2750 | &session->ftPEContext.pFTPreAuthReq-> |
| 2751 | pbssDescription->mdie[0], |
| 2752 | SIR_MDIE_SIZE); |
| 2753 | } |
Pragaspathi Thilagaraj | 239883a | 2019-03-08 00:33:50 +0530 | [diff] [blame] | 2754 | } else if ((auth_frame->authAlgoNumber == |
| 2755 | SIR_FILS_SK_WITHOUT_PFS) && |
| 2756 | (auth_frame->authTransactionSeqNumber == |
| 2757 | SIR_MAC_AUTH_FRAME_1)) { |
| 2758 | pe_debug("FILS: appending fils Auth data"); |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2759 | lim_add_fils_data_to_auth_frame(session, body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2760 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2761 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2762 | pe_debug("*** Sending Auth seq# %d status %d (%d) to " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2763 | QDF_MAC_ADDR_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2764 | auth_frame->authTransactionSeqNumber, |
| 2765 | auth_frame->authStatusCode, |
| 2766 | (auth_frame->authStatusCode == |
| 2767 | eSIR_MAC_SUCCESS_STATUS), |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2768 | QDF_MAC_ADDR_ARRAY(mac_hdr->da)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2769 | } |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2770 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, |
| 2771 | QDF_TRACE_LEVEL_DEBUG, |
| 2772 | frame, frame_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2773 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2774 | if ((session->ftPEContext.pFTPreAuthReq) && |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 2775 | (lim_get_rf_band( |
| 2776 | session->ftPEContext.pFTPreAuthReq->preAuthchannelNum)) == |
| 2777 | BAND_5G) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2778 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 2779 | else if (wlan_reg_is_5ghz_ch_freq(session->curr_op_freq) || |
| 2780 | session->opmode == QDF_P2P_CLIENT_MODE || |
| 2781 | session->opmode == QDF_P2P_GO_MODE) |
Deepthi Gowri | 1de51e3 | 2016-09-01 15:47:28 +0530 | [diff] [blame] | 2782 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2783 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 2784 | if (session->opmode == QDF_P2P_CLIENT_MODE || |
| 2785 | session->opmode == QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2786 | tx_flag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2787 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2788 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2789 | session->peSessionId, mac_hdr->fc.subType)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2790 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2791 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_NOT_RCD; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2792 | min_rid = lim_get_min_session_txrate(session); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2793 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2794 | session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Rajasekaran Kalidoss | 7152a35 | 2018-11-19 09:58:35 +0530 | [diff] [blame] | 2795 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2796 | if (session->ftPEContext.pFTPreAuthReq) |
Rajasekaran Kalidoss | 7152a35 | 2018-11-19 09:58:35 +0530 | [diff] [blame] | 2797 | ch_freq_tx_frame = cds_chan_to_freq( |
| 2798 | session->ftPEContext.pFTPreAuthReq->preAuthchannelNum); |
| 2799 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2800 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 2801 | (uint16_t)frame_len, |
| 2802 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 2803 | 7, lim_tx_complete, frame, |
| 2804 | lim_auth_tx_complete_cnf, |
Rajasekaran Kalidoss | 7152a35 | 2018-11-19 09:58:35 +0530 | [diff] [blame] | 2805 | tx_flag, sme_sessionid, false, |
| 2806 | ch_freq_tx_frame, min_rid); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2807 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 2808 | session->peSessionId, qdf_status)); |
| 2809 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 2810 | pe_err("*** Could not send Auth frame, retCode=%X ***", |
| 2811 | qdf_status); |
| 2812 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
| 2813 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2814 | session, SENT_FAIL, QDF_STATUS_E_FAILURE); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2815 | /* Pkt will be freed up by the callback */ |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2816 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2817 | return; |
| 2818 | } |
| 2819 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2820 | QDF_STATUS lim_send_deauth_cnf(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2821 | { |
| 2822 | uint16_t aid; |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2823 | tpDphHashNode sta_ds; |
| 2824 | tLimMlmDeauthReq *deauth_req; |
| 2825 | tLimMlmDeauthCnf deauth_cnf; |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 2826 | struct pe_session *session_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2827 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2828 | deauth_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 2829 | if (deauth_req) { |
| 2830 | if (tx_timer_running( |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 2831 | &mac_ctx->lim.lim_timers.gLimDeauthAckTimer)) |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2832 | lim_deactivate_and_change_timer(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2833 | eLIM_DEAUTH_ACK_TIMER); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2834 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2835 | session_entry = pe_find_session_by_session_id(mac_ctx, |
| 2836 | deauth_req->sessionId); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2837 | if (!session_entry) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2838 | pe_err("session does not exist for given sessionId"); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2839 | deauth_cnf.resultCode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2840 | eSIR_SME_INVALID_PARAMETERS; |
| 2841 | goto end; |
| 2842 | } |
| 2843 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2844 | sta_ds = |
| 2845 | dph_lookup_hash_entry(mac_ctx, |
| 2846 | deauth_req->peer_macaddr.bytes, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 2847 | &aid, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2848 | &session_entry->dph.dphHashTable); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2849 | if (!sta_ds) { |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2850 | deauth_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2851 | goto end; |
| 2852 | } |
| 2853 | |
| 2854 | /* / Receive path cleanup with dummy packet */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2855 | lim_ft_cleanup_pre_auth_info(mac_ctx, session_entry); |
| 2856 | lim_cleanup_rx_path(mac_ctx, sta_ds, session_entry); |
| 2857 | if ((session_entry->limSystemRole == eLIM_STA_ROLE) && |
| 2858 | ( |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 2859 | #ifdef FEATURE_WLAN_ESE |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2860 | (session_entry->isESEconnection) || |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 2861 | #endif |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2862 | (session_entry->isFastRoamIniFeatureEnabled) || |
| 2863 | (session_entry->is11Rconnection))) { |
Jeff Johnson | 11bd4f3 | 2017-09-18 08:15:17 -0700 | [diff] [blame] | 2864 | pe_debug("FT Preauth (%pK,%d) Deauth rc %d src = %d", |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2865 | session_entry, |
| 2866 | session_entry->peSessionId, |
| 2867 | deauth_req->reasonCode, |
| 2868 | deauth_req->deauthTrigger); |
| 2869 | lim_ft_cleanup(mac_ctx, session_entry); |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2870 | } else { |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2871 | #ifdef FEATURE_WLAN_ESE |
Nirav Shah | f359dd2 | 2019-02-20 10:34:28 +0530 | [diff] [blame] | 2872 | pe_debug("No FT Preauth Session Cleanup in role %d" |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2873 | " isESE %d" |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2874 | " isLFR %d" |
| 2875 | " is11r %d, Deauth reason %d Trigger = %d", |
| 2876 | session_entry->limSystemRole, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2877 | session_entry->isESEconnection, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2878 | session_entry->isFastRoamIniFeatureEnabled, |
| 2879 | session_entry->is11Rconnection, |
| 2880 | deauth_req->reasonCode, |
| 2881 | deauth_req->deauthTrigger); |
Nirav Shah | f359dd2 | 2019-02-20 10:34:28 +0530 | [diff] [blame] | 2882 | #else |
| 2883 | pe_debug("No FT Preauth Session Cleanup in role %d" |
| 2884 | " isLFR %d" |
| 2885 | " is11r %d, Deauth reason %d Trigger = %d", |
| 2886 | session_entry->limSystemRole, |
| 2887 | session_entry->isFastRoamIniFeatureEnabled, |
| 2888 | session_entry->is11Rconnection, |
| 2889 | deauth_req->reasonCode, |
| 2890 | deauth_req->deauthTrigger); |
| 2891 | #endif |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2892 | } |
| 2893 | /* Free up buffer allocated for mlmDeauthReq */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2894 | qdf_mem_free(deauth_req); |
| 2895 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2896 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2897 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2898 | end: |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2899 | qdf_copy_macaddr(&deauth_cnf.peer_macaddr, |
| 2900 | &deauth_req->peer_macaddr); |
| 2901 | deauth_cnf.deauthTrigger = deauth_req->deauthTrigger; |
| 2902 | deauth_cnf.aid = deauth_req->aid; |
| 2903 | deauth_cnf.sessionId = deauth_req->sessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2904 | |
| 2905 | /* Free up buffer allocated */ |
| 2906 | /* for mlmDeauthReq */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2907 | qdf_mem_free(deauth_req); |
| 2908 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2909 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2910 | lim_post_sme_message(mac_ctx, |
| 2911 | LIM_MLM_DEAUTH_CNF, (uint32_t *) &deauth_cnf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2912 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2913 | } |
| 2914 | |
| 2915 | /** |
| 2916 | * lim_send_disassoc_cnf() - Send disassoc confirmation to SME |
| 2917 | * |
| 2918 | * @mac_ctx: Handle to MAC context |
| 2919 | * |
| 2920 | * Sends disassoc confirmation to SME. Removes disassoc request stored |
| 2921 | * in lim. |
| 2922 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2923 | * Return: QDF_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2924 | */ |
| 2925 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2926 | QDF_STATUS lim_send_disassoc_cnf(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2927 | { |
| 2928 | uint16_t aid; |
| 2929 | tpDphHashNode sta_ds; |
| 2930 | tLimMlmDisassocCnf disassoc_cnf; |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 2931 | struct pe_session *pe_session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2932 | tLimMlmDisassocReq *disassoc_req; |
| 2933 | |
| 2934 | disassoc_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 2935 | if (disassoc_req) { |
| 2936 | if (tx_timer_running( |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 2937 | &mac_ctx->lim.lim_timers.gLimDisassocAckTimer)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2938 | lim_deactivate_and_change_timer(mac_ctx, |
| 2939 | eLIM_DISASSOC_ACK_TIMER); |
| 2940 | |
| 2941 | pe_session = pe_find_session_by_session_id( |
| 2942 | mac_ctx, disassoc_req->sessionId); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2943 | if (!pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2944 | pe_err("No session for given sessionId"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2945 | disassoc_cnf.resultCode = |
| 2946 | eSIR_SME_INVALID_PARAMETERS; |
| 2947 | goto end; |
| 2948 | } |
| 2949 | |
| 2950 | sta_ds = dph_lookup_hash_entry(mac_ctx, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 2951 | disassoc_req->peer_macaddr.bytes, &aid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2952 | &pe_session->dph.dphHashTable); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2953 | if (!sta_ds) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2954 | pe_err("StaDs Null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2955 | disassoc_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 2956 | goto end; |
| 2957 | } |
| 2958 | /* Receive path cleanup with dummy packet */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2959 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2960 | lim_cleanup_rx_path(mac_ctx, sta_ds, pe_session)) { |
| 2961 | disassoc_cnf.resultCode = |
| 2962 | eSIR_SME_RESOURCES_UNAVAILABLE; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2963 | pe_err("cleanup_rx_path error"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2964 | goto end; |
| 2965 | } |
Deepak Dhamdhere | 57c95ff | 2016-09-30 16:44:44 -0700 | [diff] [blame] | 2966 | if (LIM_IS_STA_ROLE(pe_session) && |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2967 | (disassoc_req->reasonCode != |
| 2968 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) { |
Jeff Johnson | 11bd4f3 | 2017-09-18 08:15:17 -0700 | [diff] [blame] | 2969 | pe_debug("FT Preauth Session (%pK %d) Clean up", |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2970 | pe_session, pe_session->peSessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2971 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2972 | /* Delete FT session if there exists one */ |
| 2973 | lim_ft_cleanup_pre_auth_info(mac_ctx, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2974 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2975 | /* Free up buffer allocated for mlmDisassocReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2976 | qdf_mem_free(disassoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2977 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2978 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2979 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2980 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2981 | } |
| 2982 | end: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2983 | qdf_mem_copy((uint8_t *) &disassoc_cnf.peerMacAddr, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 2984 | (uint8_t *) disassoc_req->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2985 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2986 | disassoc_cnf.aid = disassoc_req->aid; |
| 2987 | disassoc_cnf.disassocTrigger = disassoc_req->disassocTrigger; |
| 2988 | |
| 2989 | /* Update PE session ID */ |
| 2990 | disassoc_cnf.sessionId = disassoc_req->sessionId; |
| 2991 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2992 | if (disassoc_req) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2993 | /* / Free up buffer allocated for mlmDisassocReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2994 | qdf_mem_free(disassoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2995 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 2996 | } |
| 2997 | |
| 2998 | lim_post_sme_message(mac_ctx, LIM_MLM_DISASSOC_CNF, |
| 2999 | (uint32_t *) &disassoc_cnf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3000 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3001 | } |
| 3002 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3003 | QDF_STATUS lim_disassoc_tx_complete_cnf(void *context, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3004 | uint32_t tx_success, |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3005 | void *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3006 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3007 | struct mac_context *max_ctx = (struct mac_context *)context; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3008 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3009 | pe_debug("tx_success: %d", tx_success); |
| 3010 | |
| 3011 | return lim_send_disassoc_cnf(max_ctx); |
| 3012 | } |
| 3013 | |
| 3014 | static QDF_STATUS lim_disassoc_tx_complete_cnf_handler(void *context, |
| 3015 | qdf_nbuf_t buf, |
| 3016 | uint32_t tx_success, |
| 3017 | void *params) |
| 3018 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3019 | struct mac_context *max_ctx = (struct mac_context *)context; |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3020 | QDF_STATUS status_code; |
| 3021 | struct scheduler_msg msg = {0}; |
| 3022 | |
| 3023 | pe_debug("tx_success: %d", tx_success); |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 3024 | |
| 3025 | if (buf) |
| 3026 | qdf_nbuf_free(buf); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3027 | msg.type = (uint16_t) WMA_DISASSOC_TX_COMP; |
| 3028 | msg.bodyptr = params; |
| 3029 | msg.bodyval = tx_success; |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 3030 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3031 | status_code = lim_post_msg_high_priority(max_ctx, &msg); |
| 3032 | if (status_code != QDF_STATUS_SUCCESS) |
| 3033 | pe_err("posting message: %X to LIM failed, reason: %d", |
| 3034 | msg.type, status_code); |
| 3035 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3036 | } |
| 3037 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3038 | QDF_STATUS lim_deauth_tx_complete_cnf(void *context, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3039 | uint32_t tx_success, |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3040 | void *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3041 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3042 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3043 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3044 | pe_debug("tx_success: %d", tx_success); |
| 3045 | |
| 3046 | return lim_send_deauth_cnf(mac_ctx); |
| 3047 | } |
| 3048 | |
| 3049 | static QDF_STATUS lim_deauth_tx_complete_cnf_handler(void *context, |
| 3050 | qdf_nbuf_t buf, |
| 3051 | uint32_t tx_success, |
| 3052 | void *params) |
| 3053 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3054 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3055 | QDF_STATUS status_code; |
| 3056 | struct scheduler_msg msg = {0}; |
| 3057 | |
| 3058 | pe_debug("tx_success: %d", tx_success); |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 3059 | |
| 3060 | if (buf) |
| 3061 | qdf_nbuf_free(buf); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3062 | msg.type = (uint16_t) WMA_DEAUTH_TX_COMP; |
| 3063 | msg.bodyptr = params; |
| 3064 | msg.bodyval = tx_success; |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 3065 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3066 | status_code = lim_post_msg_high_priority(mac_ctx, &msg); |
| 3067 | if (status_code != QDF_STATUS_SUCCESS) |
| 3068 | pe_err("posting message: %X to LIM failed, reason: %d", |
| 3069 | msg.type, status_code); |
| 3070 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3071 | } |
| 3072 | |
| 3073 | /** |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3074 | * lim_append_ies_to_frame() - Append IEs to the frame |
| 3075 | * |
| 3076 | * @frame: Pointer to the frame buffer that needs to be populated |
| 3077 | * @frame_len: Pointer for current frame length |
| 3078 | * @ie: pointer for disconnect IEs |
| 3079 | * |
| 3080 | * This function is called by lim_send_disassoc_mgmt_frame and |
| 3081 | * lim_send_deauth_mgmt_frame APIs as part of disconnection. |
| 3082 | * Append IEs and update frame length. |
| 3083 | * |
| 3084 | * Return: None |
| 3085 | */ |
| 3086 | static void |
| 3087 | lim_append_ies_to_frame(uint8_t *frame, uint32_t *frame_len, |
| 3088 | struct wlan_ies *ie) |
| 3089 | { |
| 3090 | if (!ie || !ie->len || !ie->data) |
| 3091 | return; |
| 3092 | qdf_mem_copy(frame, ie->data, ie->len); |
| 3093 | *frame_len += ie->len; |
| 3094 | pe_debug("Appended IEs len: %u", ie->len); |
| 3095 | } |
| 3096 | |
| 3097 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3098 | * \brief This function is called to send Disassociate frame. |
| 3099 | * |
| 3100 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3101 | * \param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3102 | * |
| 3103 | * \param nReason Indicates the reason that need to be sent in |
| 3104 | * Disassociation frame |
| 3105 | * |
| 3106 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 3107 | * sent |
| 3108 | * |
| 3109 | * |
| 3110 | */ |
| 3111 | |
| 3112 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3113 | lim_send_disassoc_mgmt_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3114 | uint16_t nReason, |
| 3115 | tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3116 | struct pe_session *pe_session, bool waitForAck) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3117 | { |
| 3118 | tDot11fDisassociation frm; |
| 3119 | uint8_t *pFrame; |
| 3120 | tpSirMacMgmtHdr pMacHdr; |
| 3121 | uint32_t nBytes, nPayload, nStatus; |
| 3122 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3123 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3124 | uint8_t txFlag = 0; |
| 3125 | uint32_t val = 0; |
| 3126 | uint8_t smeSessionId = 0; |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3127 | struct wlan_ies *discon_ie; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 3128 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3129 | if (!pe_session) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3130 | return; |
| 3131 | } |
| 3132 | |
| 3133 | /* |
| 3134 | * In case when cac timer is running for this SAP session then |
| 3135 | * avoid sending disassoc out. It is violation of dfs specification. |
| 3136 | */ |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3137 | if (((pe_session->opmode == QDF_SAP_MODE) || |
| 3138 | (pe_session->opmode == QDF_P2P_GO_MODE)) && |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3139 | (true == mac->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3140 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3141 | FL("CAC timer is running, drop disassoc from going out")); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3142 | if (waitForAck) |
| 3143 | lim_send_disassoc_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3144 | return; |
| 3145 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3146 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3147 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3148 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3149 | |
| 3150 | frm.Reason.code = nReason; |
| 3151 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3152 | nStatus = dot11f_get_packed_disassociation_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3153 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3154 | 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] | 3155 | nStatus); |
| 3156 | /* We'll fall back on the worst case scenario: */ |
| 3157 | nPayload = sizeof(tDot11fDisassociation); |
| 3158 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3159 | pe_warn("There were warnings while calculating the packed size for a Disassociation (0x%08x)", |
| 3160 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3161 | } |
| 3162 | |
| 3163 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3164 | |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3165 | discon_ie = mlme_get_self_disconnect_ies(pe_session->vdev); |
| 3166 | if (discon_ie && discon_ie->len) |
| 3167 | nBytes += discon_ie->len; |
| 3168 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3169 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3170 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3171 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3172 | pe_err("Failed to allocate %d bytes for a Disassociation", |
| 3173 | nBytes); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3174 | if (waitForAck) |
| 3175 | lim_send_disassoc_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3176 | return; |
| 3177 | } |
| 3178 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3179 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3180 | |
| 3181 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3182 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3183 | SIR_MAC_MGMT_DISASSOC, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3184 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3185 | |
| 3186 | /* Prepare the BSSID */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3187 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3188 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3189 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3190 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3191 | nStatus = dot11f_pack_disassociation(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3192 | sizeof(tSirMacMgmtHdr), |
| 3193 | nPayload, &nPayload); |
| 3194 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3195 | pe_err("Failed to pack a Disassociation (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3196 | nStatus); |
| 3197 | cds_packet_free((void *)pPacket); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3198 | if (waitForAck) |
| 3199 | lim_send_disassoc_cnf(mac); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3200 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3201 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3202 | pe_warn("There were warnings while packing a Disassociation (0x%08x)", |
| 3203 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3204 | } |
| 3205 | |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3206 | /* Copy disconnect IEs to the end of the frame */ |
| 3207 | lim_append_ies_to_frame(pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3208 | &nPayload, discon_ie); |
| 3209 | mlme_free_self_disconnect_ies(pe_session->vdev); |
| 3210 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3211 | pe_debug("***Sessionid %d Sending Disassociation frame with " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3212 | "reason %u and waitForAck %d to " QDF_MAC_ADDR_STR " ,From " |
| 3213 | QDF_MAC_ADDR_STR, pe_session->peSessionId, nReason, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3214 | waitForAck, QDF_MAC_ADDR_ARRAY(pMacHdr->da), |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3215 | QDF_MAC_ADDR_ARRAY(pe_session->self_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3216 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 3217 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 3218 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 3219 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3220 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3221 | |
Sushant Kaushik | 4655606 | 2015-12-02 16:57:47 +0530 | [diff] [blame] | 3222 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3223 | |
| 3224 | if (waitForAck) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3225 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3226 | pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3227 | pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3228 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3229 | pe_session, QDF_STATUS_SUCCESS, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3230 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3231 | /* Queue Disassociation frame in high priority WQ */ |
| 3232 | /* get the duration from the request */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3233 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3234 | wma_tx_frameWithTxComplete(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3235 | TXRX_FRM_802_11_MGMT, |
| 3236 | ANI_TXDIR_TODS, 7, lim_tx_complete, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3237 | pFrame, lim_disassoc_tx_complete_cnf_handler, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3238 | txFlag, smeSessionId, false, 0, |
| 3239 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3240 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3241 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3242 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3243 | |
| 3244 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 3245 | |
| 3246 | if (tx_timer_change |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 3247 | (&mac->lim.lim_timers.gLimDisassocAckTimer, val, 0) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3248 | != TX_SUCCESS) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3249 | pe_err("Unable to change Disassoc ack Timer val"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3250 | return; |
| 3251 | } else if (TX_SUCCESS != |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 3252 | tx_timer_activate(&mac->lim.lim_timers. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3253 | gLimDisassocAckTimer)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3254 | pe_err("Unable to activate Disassoc ack Timer"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3255 | lim_deactivate_and_change_timer(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3256 | eLIM_DISASSOC_ACK_TIMER); |
| 3257 | return; |
| 3258 | } |
| 3259 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3260 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3261 | pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3262 | pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3263 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3264 | pe_session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3265 | QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3266 | /* Queue Disassociation frame in high priority WQ */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3267 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3268 | TXRX_FRM_802_11_MGMT, |
| 3269 | ANI_TXDIR_TODS, |
| 3270 | 7, |
| 3271 | lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3272 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3273 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3274 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3275 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3276 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3277 | pe_err("Failed to send Disassociation (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3278 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3279 | /* Pkt will be freed up by the callback */ |
| 3280 | } |
| 3281 | } |
| 3282 | } /* End lim_send_disassoc_mgmt_frame. */ |
| 3283 | |
| 3284 | /** |
| 3285 | * \brief This function is called to send a Deauthenticate frame |
| 3286 | * |
| 3287 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3288 | * \param mac Pointer to global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3289 | * |
| 3290 | * \param nReason Indicates the reason that need to be sent in the |
| 3291 | * Deauthenticate frame |
| 3292 | * |
| 3293 | * \param peeer address of the STA to which the frame is to be sent |
| 3294 | * |
| 3295 | * |
| 3296 | */ |
| 3297 | |
| 3298 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3299 | lim_send_deauth_mgmt_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3300 | uint16_t nReason, |
| 3301 | tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3302 | struct pe_session *pe_session, bool waitForAck) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3303 | { |
| 3304 | tDot11fDeAuth frm; |
| 3305 | uint8_t *pFrame; |
| 3306 | tpSirMacMgmtHdr pMacHdr; |
| 3307 | uint32_t nBytes, nPayload, nStatus; |
| 3308 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3309 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3310 | uint8_t txFlag = 0; |
| 3311 | uint32_t val = 0; |
| 3312 | #ifdef FEATURE_WLAN_TDLS |
| 3313 | uint16_t aid; |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3314 | tpDphHashNode sta; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3315 | #endif |
| 3316 | uint8_t smeSessionId = 0; |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3317 | struct wlan_ies *discon_ie; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3318 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3319 | if (!pe_session) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3320 | return; |
| 3321 | } |
| 3322 | |
| 3323 | /* |
| 3324 | * In case when cac timer is running for this SAP session then |
| 3325 | * avoid deauth frame out. It is violation of dfs specification. |
| 3326 | */ |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3327 | if (((pe_session->opmode == QDF_SAP_MODE) || |
| 3328 | (pe_session->opmode == QDF_P2P_GO_MODE)) && |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3329 | (true == mac->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3330 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3331 | FL |
| 3332 | ("CAC timer is running, drop the deauth from going out")); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3333 | if (waitForAck) |
| 3334 | lim_send_deauth_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3335 | return; |
| 3336 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3337 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3338 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3339 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3340 | |
| 3341 | frm.Reason.code = nReason; |
| 3342 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3343 | nStatus = dot11f_get_packed_de_auth_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3344 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3345 | 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] | 3346 | nStatus); |
| 3347 | /* We'll fall back on the worst case scenario: */ |
| 3348 | nPayload = sizeof(tDot11fDeAuth); |
| 3349 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3350 | pe_warn("There were warnings while calculating the packed size for a De-Authentication (0x%08x)", |
| 3351 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3352 | } |
| 3353 | |
| 3354 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3355 | discon_ie = mlme_get_self_disconnect_ies(pe_session->vdev); |
| 3356 | if (discon_ie && discon_ie->len) |
| 3357 | nBytes += discon_ie->len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3358 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3359 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3360 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3361 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3362 | pe_err("Failed to allocate %d bytes for a De-Authentication", |
| 3363 | nBytes); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3364 | if (waitForAck) |
| 3365 | lim_send_deauth_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3366 | return; |
| 3367 | } |
| 3368 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3369 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3370 | |
| 3371 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3372 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3373 | SIR_MAC_MGMT_DEAUTH, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3374 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3375 | |
| 3376 | /* Prepare the BSSID */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3377 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3378 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3379 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3380 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3381 | nStatus = dot11f_pack_de_auth(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3382 | sizeof(tSirMacMgmtHdr), nPayload, &nPayload); |
| 3383 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3384 | pe_err("Failed to pack a DeAuthentication (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3385 | nStatus); |
| 3386 | cds_packet_free((void *)pPacket); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3387 | if (waitForAck) |
| 3388 | lim_send_deauth_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3389 | return; |
| 3390 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3391 | pe_warn("There were warnings while packing a De-Authentication (0x%08x)", |
| 3392 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3393 | } |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3394 | |
| 3395 | /* Copy disconnect IEs to the end of the frame */ |
| 3396 | lim_append_ies_to_frame(pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3397 | &nPayload, discon_ie); |
| 3398 | mlme_free_self_disconnect_ies(pe_session->vdev); |
| 3399 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3400 | pe_debug("***Sessionid %d Sending Deauth frame with " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3401 | "reason %u and waitForAck %d to " QDF_MAC_ADDR_STR |
| 3402 | " ,From " QDF_MAC_ADDR_STR, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3403 | pe_session->peSessionId, nReason, waitForAck, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3404 | QDF_MAC_ADDR_ARRAY(pMacHdr->da), |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3405 | QDF_MAC_ADDR_ARRAY(pe_session->self_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3406 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 3407 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 3408 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 3409 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3410 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3411 | |
Sushant Kaushik | 4655606 | 2015-12-02 16:57:47 +0530 | [diff] [blame] | 3412 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3413 | #ifdef FEATURE_WLAN_TDLS |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3414 | sta = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3415 | dph_lookup_hash_entry(mac, peer, &aid, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3416 | &pe_session->dph.dphHashTable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3417 | #endif |
| 3418 | |
| 3419 | if (waitForAck) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3420 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3421 | pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3422 | pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3423 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3424 | pe_session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3425 | QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3426 | /* Queue Disassociation frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3427 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3428 | wma_tx_frameWithTxComplete(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3429 | TXRX_FRM_802_11_MGMT, |
| 3430 | ANI_TXDIR_TODS, 7, lim_tx_complete, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3431 | pFrame, lim_deauth_tx_complete_cnf_handler, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3432 | txFlag, smeSessionId, false, 0, |
| 3433 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3434 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3435 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3436 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3437 | /* Pkt will be freed up by the callback lim_tx_complete */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3438 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3439 | pe_err("Failed to send De-Authentication (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3440 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3441 | |
| 3442 | /* Call lim_process_deauth_ack_timeout which will send |
| 3443 | * DeauthCnf for this frame |
| 3444 | */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3445 | lim_process_deauth_ack_timeout(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3446 | return; |
| 3447 | } |
| 3448 | |
| 3449 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 3450 | |
| 3451 | if (tx_timer_change |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 3452 | (&mac->lim.lim_timers.gLimDeauthAckTimer, val, 0) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3453 | != TX_SUCCESS) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3454 | pe_err("Unable to change Deauth ack Timer val"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3455 | return; |
| 3456 | } else if (TX_SUCCESS != |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 3457 | tx_timer_activate(&mac->lim.lim_timers. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3458 | gLimDeauthAckTimer)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3459 | pe_err("Unable to activate Deauth ack Timer"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3460 | lim_deactivate_and_change_timer(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3461 | eLIM_DEAUTH_ACK_TIMER); |
| 3462 | return; |
| 3463 | } |
| 3464 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3465 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3466 | pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3467 | pMacHdr->fc.subType)); |
| 3468 | #ifdef FEATURE_WLAN_TDLS |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3469 | if ((sta) |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3470 | && (STA_ENTRY_TDLS_PEER == sta->staType)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3471 | /* Queue Disassociation frame in high priority WQ */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3472 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3473 | pe_session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3474 | QDF_STATUS_SUCCESS, |
| 3475 | QDF_STATUS_SUCCESS); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3476 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3477 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3478 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_IBSS, |
| 3479 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3480 | smeSessionId, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3481 | } else { |
| 3482 | #endif |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3483 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3484 | pe_session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3485 | QDF_STATUS_SUCCESS, |
| 3486 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3487 | /* Queue Disassociation frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3488 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3489 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3490 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3491 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3492 | smeSessionId, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3493 | #ifdef FEATURE_WLAN_TDLS |
| 3494 | } |
| 3495 | #endif |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3496 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3497 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3498 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3499 | pe_err("Failed to send De-Authentication (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3500 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3501 | /* Pkt will be freed up by the callback */ |
| 3502 | } |
| 3503 | } |
| 3504 | |
| 3505 | } /* End lim_send_deauth_mgmt_frame. */ |
| 3506 | |
| 3507 | #ifdef ANI_SUPPORT_11H |
| 3508 | /** |
| 3509 | * \brief Send a Measurement Report Action frame |
| 3510 | * |
| 3511 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3512 | * \param mac Pointer to the global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3513 | * |
| 3514 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 3515 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3516 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3517 | * |
| 3518 | * |
| 3519 | */ |
| 3520 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3521 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3522 | lim_send_meas_report_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3523 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3524 | tSirMacAddr peer, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3525 | { |
| 3526 | tDot11fMeasurementReport frm; |
| 3527 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3528 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3529 | tpSirMacMgmtHdr pMacHdr; |
| 3530 | uint32_t nBytes, nPayload, nStatus; |
| 3531 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3532 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3533 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3534 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3535 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 3536 | frm.Category.category = ACTION_CATEGORY_SPECTRUM_MGMT; |
Srinivas Girigowda | f8e5d2e | 2019-05-28 11:49:29 -0700 | [diff] [blame] | 3537 | frm.Action.action = ACTION_SPCT_MSR_RPRT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3538 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 3539 | |
| 3540 | switch (pMeasReqFrame->measReqIE.measType) { |
| 3541 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 3542 | nSirStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3543 | populate_dot11f_measurement_report0(mac, pMeasReqFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3544 | &frm.MeasurementReport); |
| 3545 | break; |
| 3546 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 3547 | nSirStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3548 | populate_dot11f_measurement_report1(mac, pMeasReqFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3549 | &frm.MeasurementReport); |
| 3550 | break; |
| 3551 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 3552 | nSirStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3553 | populate_dot11f_measurement_report2(mac, pMeasReqFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3554 | &frm.MeasurementReport); |
| 3555 | break; |
| 3556 | default: |
Jeff Johnson | 0711e27 | 2018-12-14 23:16:38 -0800 | [diff] [blame] | 3557 | pe_err("Unknown measurement type %d in limSendMeasReportFrame", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3558 | pMeasReqFrame->measReqIE.measType); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3559 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3560 | } |
| 3561 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3562 | if (QDF_STATUS_SUCCESS != nSirStatus) |
| 3563 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3564 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3565 | nStatus = dot11f_get_packed_measurement_report_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3566 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3567 | 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] | 3568 | nStatus); |
| 3569 | /* We'll fall back on the worst case scenario: */ |
| 3570 | nPayload = sizeof(tDot11fMeasurementReport); |
| 3571 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3572 | pe_warn("There were warnings while calculating the packed size for a Measurement Report (0x%08x)", |
| 3573 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3574 | } |
| 3575 | |
| 3576 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3577 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3578 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3579 | cds_packet_alloc(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3580 | (uint16_t) nBytes, (void **)&pFrame, |
| 3581 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3582 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 0711e27 | 2018-12-14 23:16:38 -0800 | [diff] [blame] | 3583 | pe_err("Failed to allocate %d bytes for a De-Authentication", |
| 3584 | nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3585 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3586 | } |
| 3587 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3588 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3589 | |
| 3590 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3591 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3592 | SIR_MAC_MGMT_ACTION, peer); |
| 3593 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3594 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3595 | qdf_mem_copy(pMacHdr->bssId, pe_session->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3596 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3597 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3598 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3599 | nStatus = dot11f_pack_measurement_report(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3600 | sizeof(tSirMacMgmtHdr), |
| 3601 | nPayload, &nPayload); |
| 3602 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3603 | pe_err("Failed to pack a Measurement Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3604 | nStatus); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3605 | cds_packet_free(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3606 | (void *)pFrame, (void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3607 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3608 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3609 | pe_warn("There were warnings while packing a Measurement Report (0x%08x)", |
| 3610 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3611 | } |
| 3612 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3613 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3614 | ((pe_session) ? pe_session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3615 | peSessionId : NO_SESSION), pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3616 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3617 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3618 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3619 | lim_tx_complete, pFrame, 0, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3620 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3621 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3622 | ((pe_session) ? pe_session->peSessionId : NO_SESSION), |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3623 | qdf_status)); |
| 3624 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3625 | pe_err("Failed to send a Measurement Report (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3626 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3627 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3628 | return QDF_STATUS_E_FAILURE; /* just allocated... */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3629 | } |
| 3630 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3631 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3632 | |
| 3633 | } /* End lim_send_meas_report_frame. */ |
| 3634 | |
| 3635 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3636 | * \brief Send a TPC Report Action frame |
| 3637 | * |
| 3638 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3639 | * \param mac Pointer to the global MAC datastructure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3640 | * |
| 3641 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 3642 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3643 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3644 | * |
| 3645 | * |
| 3646 | */ |
| 3647 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3648 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3649 | lim_send_tpc_report_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3650 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3651 | tSirMacAddr peer, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3652 | { |
| 3653 | tDot11fTPCReport frm; |
| 3654 | uint8_t *pFrame; |
| 3655 | tpSirMacMgmtHdr pMacHdr; |
| 3656 | uint32_t nBytes, nPayload, nStatus; |
| 3657 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3658 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3659 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3660 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3661 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 3662 | frm.Category.category = ACTION_CATEGORY_SPECTRUM_MGMT; |
Srinivas Girigowda | f8e5d2e | 2019-05-28 11:49:29 -0700 | [diff] [blame] | 3663 | frm.Action.action = ACTION_SPCT_TPC_RPRT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3664 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 3665 | |
| 3666 | frm.TPCReport.tx_power = 0; |
| 3667 | frm.TPCReport.link_margin = 0; |
| 3668 | frm.TPCReport.present = 1; |
| 3669 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3670 | nStatus = dot11f_get_packed_tpc_report_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3671 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3672 | 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] | 3673 | /* We'll fall back on the worst case scenario: */ |
| 3674 | nPayload = sizeof(tDot11fTPCReport); |
| 3675 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3676 | pe_warn("There were warnings while calculating the packed size for a TPC Report (0x%08x)", |
| 3677 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3678 | } |
| 3679 | |
| 3680 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3681 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3682 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3683 | cds_packet_alloc(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3684 | (uint16_t) nBytes, (void **)&pFrame, |
| 3685 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3686 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3687 | pe_err("Failed to allocate %d bytes for a TPC" |
| 3688 | " Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3689 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3690 | } |
| 3691 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3692 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3693 | |
| 3694 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3695 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3696 | SIR_MAC_MGMT_ACTION, peer); |
| 3697 | |
| 3698 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3699 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3700 | qdf_mem_copy(pMacHdr->bssId, pe_session->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3701 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3702 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3703 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3704 | nStatus = dot11f_pack_tpc_report(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3705 | sizeof(tSirMacMgmtHdr), |
| 3706 | nPayload, &nPayload); |
| 3707 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3708 | pe_err("Failed to pack a TPC Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3709 | nStatus); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3710 | cds_packet_free(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3711 | (void *)pFrame, (void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3712 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3713 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3714 | pe_warn("There were warnings while packing a TPC Report (0x%08x)", |
| 3715 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3716 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3717 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3718 | ((pe_session) ? pe_session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3719 | peSessionId : NO_SESSION), pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3720 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3721 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3722 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3723 | lim_tx_complete, pFrame, 0, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3724 | MTRACE(qdf_trace |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3725 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3726 | ((pe_session) ? pe_session->peSessionId : NO_SESSION), |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3727 | qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3728 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3729 | pe_err("Failed to send a TPC Report (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3730 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3731 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3732 | return QDF_STATUS_E_FAILURE; /* just allocated... */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3733 | } |
| 3734 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3735 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3736 | |
| 3737 | } /* End lim_send_tpc_report_frame. */ |
| 3738 | #endif /* ANI_SUPPORT_11H */ |
| 3739 | |
| 3740 | /** |
| 3741 | * \brief Send a Channel Switch Announcement |
| 3742 | * |
| 3743 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3744 | * \param mac Pointer to the global MAC datastructure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3745 | * |
| 3746 | * \param peer MAC address to which this frame will be sent |
| 3747 | * |
| 3748 | * \param nMode |
| 3749 | * |
| 3750 | * \param nNewChannel |
| 3751 | * |
| 3752 | * \param nCount |
| 3753 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3754 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3755 | * |
| 3756 | * |
| 3757 | */ |
| 3758 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3759 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3760 | lim_send_channel_switch_mgmt_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3761 | tSirMacAddr peer, |
| 3762 | uint8_t nMode, |
| 3763 | uint8_t nNewChannel, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3764 | uint8_t nCount, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3765 | { |
| 3766 | tDot11fChannelSwitch frm; |
| 3767 | uint8_t *pFrame; |
| 3768 | tpSirMacMgmtHdr pMacHdr; |
| 3769 | uint32_t nBytes, nPayload, nStatus; /* , nCfg; */ |
| 3770 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3771 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3772 | uint8_t txFlag = 0; |
| 3773 | |
| 3774 | uint8_t smeSessionId = 0; |
| 3775 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3776 | if (!pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3777 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3778 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3779 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3780 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3781 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3782 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3783 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 3784 | frm.Category.category = ACTION_CATEGORY_SPECTRUM_MGMT; |
Srinivas Girigowda | f8e5d2e | 2019-05-28 11:49:29 -0700 | [diff] [blame] | 3785 | frm.Action.action = ACTION_SPCT_CHL_SWITCH; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3786 | frm.ChanSwitchAnn.switchMode = nMode; |
| 3787 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 3788 | frm.ChanSwitchAnn.switchCount = nCount; |
| 3789 | frm.ChanSwitchAnn.present = 1; |
| 3790 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3791 | nStatus = dot11f_get_packed_channel_switch_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3792 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3793 | 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] | 3794 | nStatus); |
| 3795 | /* We'll fall back on the worst case scenario: */ |
| 3796 | nPayload = sizeof(tDot11fChannelSwitch); |
| 3797 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3798 | pe_warn("There were warnings while calculating the packed size for a Channel Switch (0x%08x)", |
| 3799 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3800 | } |
| 3801 | |
| 3802 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3803 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3804 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3805 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 3806 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3807 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3808 | pe_err("Failed to allocate %d bytes for a TPC Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3809 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3810 | } |
| 3811 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3812 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3813 | |
| 3814 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3815 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3816 | SIR_MAC_MGMT_ACTION, peer, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3817 | pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3818 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3819 | qdf_mem_copy((uint8_t *) pMacHdr->bssId, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3820 | (uint8_t *) pe_session->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3821 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3822 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3823 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3824 | nStatus = dot11f_pack_channel_switch(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3825 | sizeof(tSirMacMgmtHdr), |
| 3826 | nPayload, &nPayload); |
| 3827 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3828 | pe_err("Failed to pack a Channel Switch (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3829 | nStatus); |
| 3830 | cds_packet_free((void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3831 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3832 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3833 | pe_warn("There were warnings while packing a Channel Switch (0x%08x)", |
| 3834 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3835 | } |
| 3836 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 3837 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 3838 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 3839 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3840 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3841 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3842 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3843 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3844 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3845 | TXRX_FRM_802_11_MGMT, |
| 3846 | ANI_TXDIR_TODS, |
| 3847 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3848 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3849 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3850 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3851 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3852 | pe_err("Failed to send a Channel Switch (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3853 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3854 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3855 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3856 | } |
| 3857 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3858 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3859 | |
| 3860 | } /* End lim_send_channel_switch_mgmt_frame. */ |
| 3861 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3862 | /** |
| 3863 | * lim_send_extended_chan_switch_action_frame()- function to send ECSA |
| 3864 | * action frame over the air . |
| 3865 | * @mac_ctx: pointer to global mac structure |
| 3866 | * @peer: Destination mac. |
| 3867 | * @mode: channel switch mode |
| 3868 | * @new_op_class: new op class |
| 3869 | * @new_channel: new channel to switch |
| 3870 | * @count: channel switch count |
| 3871 | * |
| 3872 | * This function is called to send ECSA frame. |
| 3873 | * |
| 3874 | * Return: success if frame is sent else return failure |
| 3875 | */ |
| 3876 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3877 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3878 | lim_send_extended_chan_switch_action_frame(struct mac_context *mac_ctx, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3879 | tSirMacAddr peer, uint8_t mode, uint8_t new_op_class, |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 3880 | uint8_t new_channel, uint8_t count, struct pe_session *session_entry) |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3881 | { |
| 3882 | tDot11fext_channel_switch_action_frame frm; |
| 3883 | uint8_t *frame; |
| 3884 | tpSirMacMgmtHdr mac_hdr; |
| 3885 | uint32_t num_bytes, n_payload, status; |
| 3886 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3887 | QDF_STATUS qdf_status; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3888 | uint8_t txFlag = 0; |
| 3889 | uint8_t sme_session_id = 0; |
Vignesh Viswanathan | 93b7f70 | 2017-12-19 17:48:45 +0530 | [diff] [blame] | 3890 | uint8_t ch_spacing; |
| 3891 | tLimWiderBWChannelSwitchInfo *wide_bw_ie; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3892 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3893 | if (!session_entry) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3894 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3895 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3896 | } |
| 3897 | |
| 3898 | sme_session_id = session_entry->smeSessionId; |
| 3899 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3900 | qdf_mem_zero(&frm, sizeof(frm)); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3901 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 3902 | frm.Category.category = ACTION_CATEGORY_PUBLIC; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3903 | frm.Action.action = SIR_MAC_ACTION_EXT_CHANNEL_SWITCH_ID; |
| 3904 | |
| 3905 | frm.ext_chan_switch_ann_action.switch_mode = mode; |
| 3906 | frm.ext_chan_switch_ann_action.op_class = new_op_class; |
| 3907 | frm.ext_chan_switch_ann_action.new_channel = new_channel; |
| 3908 | frm.ext_chan_switch_ann_action.switch_count = count; |
| 3909 | |
Vignesh Viswanathan | 93b7f70 | 2017-12-19 17:48:45 +0530 | [diff] [blame] | 3910 | ch_spacing = wlan_reg_dmn_get_chanwidth_from_opclass( |
| 3911 | mac_ctx->scan.countryCodeCurrent, new_channel, |
| 3912 | new_op_class); |
| 3913 | pe_debug("wrapper: ch_spacing %hu", ch_spacing); |
| 3914 | |
| 3915 | if ((ch_spacing == 80) || (ch_spacing == 160)) { |
| 3916 | wide_bw_ie = &session_entry->gLimWiderBWChannelSwitch; |
| 3917 | frm.WiderBWChanSwitchAnn.newChanWidth = |
| 3918 | wide_bw_ie->newChanWidth; |
| 3919 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = |
| 3920 | wide_bw_ie->newCenterChanFreq0; |
| 3921 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = |
| 3922 | wide_bw_ie->newCenterChanFreq1; |
| 3923 | frm.WiderBWChanSwitchAnn.present = 1; |
| 3924 | pe_debug("wrapper: width:%d f0:%d f1:%d", |
| 3925 | frm.WiderBWChanSwitchAnn.newChanWidth, |
| 3926 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0, |
| 3927 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1); |
| 3928 | } |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3929 | |
| 3930 | status = dot11f_get_packed_ext_channel_switch_action_frame_size(mac_ctx, |
| 3931 | &frm, &n_payload); |
| 3932 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3933 | pe_err("Failed to get packed size for Channel Switch 0x%08x", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3934 | status); |
| 3935 | /* We'll fall back on the worst case scenario*/ |
| 3936 | n_payload = sizeof(tDot11fext_channel_switch_action_frame); |
| 3937 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3938 | 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] | 3939 | status); |
| 3940 | } |
| 3941 | |
| 3942 | num_bytes = n_payload + sizeof(tSirMacMgmtHdr); |
| 3943 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3944 | qdf_status = cds_packet_alloc((uint16_t)num_bytes, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3945 | (void **) &frame, (void **) &packet); |
| 3946 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3947 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3948 | pe_err("Failed to allocate %d bytes for a Ext Channel Switch", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3949 | num_bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3950 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3951 | } |
| 3952 | |
| 3953 | /* Paranoia*/ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3954 | qdf_mem_zero(frame, num_bytes); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3955 | |
| 3956 | /* Next, we fill out the buffer descriptor */ |
| 3957 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3958 | SIR_MAC_MGMT_ACTION, peer, session_entry->self_mac_addr); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3959 | mac_hdr = (tpSirMacMgmtHdr) frame; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3960 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3961 | (uint8_t *) session_entry->bssId, |
| 3962 | sizeof(tSirMacAddr)); |
| 3963 | |
gaolez | 4b62a9e | 2018-08-16 15:57:50 +0800 | [diff] [blame] | 3964 | lim_set_protected_bit(mac_ctx, session_entry, peer, mac_hdr); |
| 3965 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3966 | status = dot11f_pack_ext_channel_switch_action_frame(mac_ctx, &frm, |
| 3967 | frame + sizeof(tSirMacMgmtHdr), n_payload, &n_payload); |
| 3968 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3969 | pe_err("Failed to pack a Channel Switch 0x%08x", status); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3970 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3971 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3972 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3973 | pe_warn("There were warnings while packing a Channel Switch 0x%08x", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3974 | status); |
| 3975 | } |
| 3976 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 3977 | if (wlan_reg_is_5ghz_ch_freq(session_entry->curr_op_freq) || |
| 3978 | session_entry->opmode == QDF_P2P_CLIENT_MODE || |
| 3979 | session_entry->opmode == QDF_P2P_GO_MODE) |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3980 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3981 | |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3982 | pe_debug("Send Ext channel Switch to :"QDF_MAC_ADDR_STR" with swcount %d, swmode %d , newchannel %d newops %d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3983 | QDF_MAC_ADDR_ARRAY(mac_hdr->da), |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3984 | frm.ext_chan_switch_ann_action.switch_count, |
| 3985 | frm.ext_chan_switch_ann_action.switch_mode, |
| 3986 | frm.ext_chan_switch_ann_action.new_channel, |
| 3987 | frm.ext_chan_switch_ann_action.op_class); |
| 3988 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3989 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3990 | session_entry->peSessionId, mac_hdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3991 | qdf_status = wma_tx_frame(mac_ctx, packet, (uint16_t) num_bytes, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3992 | TXRX_FRM_802_11_MGMT, |
| 3993 | ANI_TXDIR_TODS, |
| 3994 | 7, |
| 3995 | lim_tx_complete, frame, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3996 | txFlag, sme_session_id, 0, |
| 3997 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3998 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3999 | session_entry->peSessionId, qdf_status)); |
| 4000 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4001 | pe_err("Failed to send a Ext Channel Switch %X!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4002 | qdf_status); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4003 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4004 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4005 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4006 | return QDF_STATUS_SUCCESS; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4007 | } /* End lim_send_extended_chan_switch_action_frame */ |
| 4008 | |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4009 | |
| 4010 | /** |
| 4011 | * lim_oper_chan_change_confirm_tx_complete_cnf()- Confirmation for oper_chan_change_confirm |
| 4012 | * sent over the air |
| 4013 | * |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 4014 | * @context: pointer to global mac |
| 4015 | * @buf: buffer |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4016 | * @tx_complete : Sent status |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 4017 | * @params: tx completion params |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4018 | * |
| 4019 | * Return: This returns QDF_STATUS |
| 4020 | */ |
| 4021 | |
| 4022 | static QDF_STATUS lim_oper_chan_change_confirm_tx_complete_cnf( |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 4023 | void *context, |
| 4024 | qdf_nbuf_t buf, |
| 4025 | uint32_t tx_complete, |
| 4026 | void *params) |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4027 | { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4028 | pe_debug("tx_complete: %d", tx_complete); |
Zhu Jianmin | 83e8b12 | 2018-05-18 19:24:45 +0800 | [diff] [blame] | 4029 | if (buf) |
| 4030 | qdf_nbuf_free(buf); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4031 | return QDF_STATUS_SUCCESS; |
| 4032 | } |
| 4033 | |
| 4034 | /** |
| 4035 | * lim_p2p_oper_chan_change_confirm_action_frame()- function to send |
| 4036 | * p2p oper chan change confirm action frame |
| 4037 | * @mac_ctx: pointer to global mac structure |
| 4038 | * @peer: Destination mac. |
| 4039 | * @session_entry: session entry |
| 4040 | * |
| 4041 | * This function is called to send p2p oper chan change confirm action frame. |
| 4042 | * |
| 4043 | * Return: success if frame is sent else return failure |
| 4044 | */ |
| 4045 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4046 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4047 | 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] | 4048 | tSirMacAddr peer, struct pe_session *session_entry) |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4049 | { |
| 4050 | tDot11fp2p_oper_chan_change_confirm frm; |
| 4051 | uint8_t *frame; |
| 4052 | tpSirMacMgmtHdr mac_hdr; |
| 4053 | uint32_t num_bytes, n_payload, status; |
| 4054 | void *packet; |
| 4055 | QDF_STATUS qdf_status; |
| 4056 | uint8_t tx_flag = 0; |
| 4057 | uint8_t sme_session_id = 0; |
| 4058 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4059 | if (!session_entry) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4060 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4061 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4062 | } |
| 4063 | |
| 4064 | sme_session_id = session_entry->smeSessionId; |
| 4065 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4066 | qdf_mem_zero(&frm, sizeof(frm)); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4067 | |
| 4068 | frm.Category.category = SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY; |
| 4069 | |
| 4070 | qdf_mem_copy(frm.p2p_action_oui.oui_data, |
| 4071 | SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE); |
| 4072 | frm.p2p_action_subtype.subtype = 0x04; |
| 4073 | frm.DialogToken.token = 0x0; |
| 4074 | |
| 4075 | if (session_entry->htCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4076 | pe_debug("Populate HT Caps in Assoc Request"); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4077 | populate_dot11f_ht_caps(mac_ctx, session_entry, &frm.HTCaps); |
| 4078 | } |
| 4079 | |
| 4080 | if (session_entry->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4081 | pe_debug("Populate VHT Caps in Assoc Request"); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4082 | populate_dot11f_vht_caps(mac_ctx, session_entry, &frm.VHTCaps); |
| 4083 | populate_dot11f_operating_mode(mac_ctx, |
| 4084 | &frm.OperatingMode, session_entry); |
| 4085 | } |
| 4086 | |
| 4087 | status = dot11f_get_packed_p2p_oper_chan_change_confirmSize(mac_ctx, |
| 4088 | &frm, &n_payload); |
| 4089 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4090 | pe_err("Failed to get packed size 0x%08x", status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4091 | /* We'll fall back on the worst case scenario*/ |
| 4092 | n_payload = sizeof(tDot11fp2p_oper_chan_change_confirm); |
| 4093 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4094 | pe_warn("There were warnings while calculating the packed size (0x%08x)", |
| 4095 | status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4096 | } |
| 4097 | |
| 4098 | num_bytes = n_payload + sizeof(tSirMacMgmtHdr); |
| 4099 | |
| 4100 | qdf_status = cds_packet_alloc((uint16_t)num_bytes, |
| 4101 | (void **) &frame, (void **) &packet); |
| 4102 | |
| 4103 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4104 | pe_err("Failed to allocate %d bytes", num_bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4105 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4106 | } |
| 4107 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4108 | qdf_mem_zero(frame, num_bytes); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4109 | |
| 4110 | /* Next, fill out the buffer descriptor */ |
| 4111 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4112 | SIR_MAC_MGMT_ACTION, peer, session_entry->self_mac_addr); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4113 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 4114 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
| 4115 | (uint8_t *) session_entry->bssId, |
| 4116 | sizeof(tSirMacAddr)); |
| 4117 | |
| 4118 | status = dot11f_pack_p2p_oper_chan_change_confirm(mac_ctx, &frm, |
| 4119 | frame + sizeof(tSirMacMgmtHdr), n_payload, &n_payload); |
| 4120 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4121 | pe_err("Failed to pack 0x%08x", status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4122 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4123 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4124 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4125 | pe_warn("There were warnings while packing 0x%08x", |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4126 | status); |
| 4127 | } |
| 4128 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4129 | if (wlan_reg_is_5ghz_ch_freq(session_entry->curr_op_freq) || |
| 4130 | session_entry->opmode == QDF_P2P_CLIENT_MODE || |
| 4131 | session_entry->opmode == QDF_P2P_GO_MODE) { |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4132 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4133 | } |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4134 | pe_debug("Send frame on channel freq %d to mac " |
| 4135 | QDF_MAC_ADDR_STR, session_entry->curr_op_freq, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 4136 | QDF_MAC_ADDR_ARRAY(peer)); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4137 | |
| 4138 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
| 4139 | session_entry->peSessionId, mac_hdr->fc.subType)); |
| 4140 | |
| 4141 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 4142 | (uint16_t)num_bytes, |
| 4143 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 4144 | 7, lim_tx_complete, frame, |
| 4145 | lim_oper_chan_change_confirm_tx_complete_cnf, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4146 | tx_flag, sme_session_id, false, 0, RATEID_DEFAULT); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4147 | |
| 4148 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 4149 | session_entry->peSessionId, qdf_status)); |
| 4150 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4151 | pe_err("Failed to send status %X!", qdf_status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4152 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4153 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4154 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4155 | return QDF_STATUS_SUCCESS; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4156 | } |
| 4157 | |
| 4158 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4159 | /** |
| 4160 | * \brief Send a Neighbor Report Request Action frame |
| 4161 | * |
| 4162 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4163 | * \param mac Pointer to the global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4164 | * |
| 4165 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 4166 | * |
| 4167 | * \param peer mac address of peer station. |
| 4168 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4169 | * \param pe_session address of session entry. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4170 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4171 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4172 | * |
| 4173 | * |
| 4174 | */ |
| 4175 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4176 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4177 | lim_send_neighbor_report_request_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4178 | tpSirMacNeighborReportReq pNeighborReq, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4179 | tSirMacAddr peer, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4180 | { |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4181 | QDF_STATUS status_code = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4182 | tDot11fNeighborReportRequest frm; |
| 4183 | uint8_t *pFrame; |
| 4184 | tpSirMacMgmtHdr pMacHdr; |
| 4185 | uint32_t nBytes, nPayload, nStatus; |
| 4186 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4187 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4188 | uint8_t txFlag = 0; |
| 4189 | uint8_t smeSessionId = 0; |
| 4190 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4191 | if (!pe_session) { |
| 4192 | pe_err("(!psession) in Request to send Neighbor Report request action frame"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4193 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4194 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4195 | smeSessionId = pe_session->smeSessionId; |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4196 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4197 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4198 | frm.Category.category = ACTION_CATEGORY_RRM; |
Srinivas Girigowda | 395addd | 2019-05-24 14:03:58 -0700 | [diff] [blame] | 4199 | frm.Action.action = RRM_NEIGHBOR_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4200 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 4201 | |
| 4202 | if (pNeighborReq->ssid_present) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4203 | populate_dot11f_ssid(mac, &pNeighborReq->ssid, &frm.SSID); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4204 | } |
| 4205 | |
| 4206 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4207 | dot11f_get_packed_neighbor_report_request_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4208 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4209 | 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] | 4210 | nStatus); |
| 4211 | /* We'll fall back on the worst case scenario: */ |
| 4212 | nPayload = sizeof(tDot11fNeighborReportRequest); |
| 4213 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4214 | pe_warn("There were warnings while calculating the packed size for a Neighbor Report Request(0x%08x)", |
| 4215 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4216 | } |
| 4217 | |
| 4218 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4219 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4220 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4221 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4222 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4223 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4224 | pe_err("Failed to allocate %d bytes for a Neighbor " |
| 4225 | "Report Request", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4226 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4227 | } |
| 4228 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4229 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4230 | |
| 4231 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4232 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4233 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4234 | |
| 4235 | /* Update A3 with the BSSID */ |
| 4236 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4237 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4238 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4239 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4240 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4241 | |
| 4242 | /* Now, we're ready to "pack" the frames */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4243 | nStatus = dot11f_pack_neighbor_report_request(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4244 | &frm, |
| 4245 | pFrame + |
| 4246 | sizeof(tSirMacMgmtHdr), |
| 4247 | nPayload, &nPayload); |
| 4248 | |
| 4249 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4250 | pe_err("Failed to pack an Neighbor Report Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4251 | nStatus); |
| 4252 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4253 | /* FIXME - Need to convert to QDF_STATUS */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4254 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4255 | goto returnAfterError; |
| 4256 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4257 | pe_warn("There were warnings while packing Neighbor Report Request (0x%08x)", |
| 4258 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4259 | } |
| 4260 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4261 | pe_debug("Sending a Neighbor Report Request to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4262 | lim_print_mac_addr(mac, peer, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4263 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4264 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 4265 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 4266 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4267 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4268 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4269 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4270 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4271 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4272 | pPacket, |
| 4273 | (uint16_t) nBytes, |
| 4274 | TXRX_FRM_802_11_MGMT, |
| 4275 | ANI_TXDIR_TODS, |
| 4276 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4277 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4278 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4279 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4280 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4281 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4282 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4283 | /* Pkt will be freed up by the callback */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4284 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4285 | } else |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4286 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4287 | |
| 4288 | returnAfterError: |
| 4289 | cds_packet_free((void *)pPacket); |
| 4290 | |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4291 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4292 | } /* End lim_send_neighbor_report_request_frame. */ |
| 4293 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4294 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4295 | lim_send_link_report_action_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4296 | tpSirMacLinkReport pLinkReport, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4297 | tSirMacAddr peer, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4298 | { |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4299 | QDF_STATUS status_code = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4300 | tDot11fLinkMeasurementReport frm; |
| 4301 | uint8_t *pFrame; |
| 4302 | tpSirMacMgmtHdr pMacHdr; |
| 4303 | uint32_t nBytes, nPayload, nStatus; |
| 4304 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4305 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4306 | uint8_t txFlag = 0; |
Pragaspathi Thilagaraj | 683c1cf | 2019-09-23 18:40:57 +0530 | [diff] [blame] | 4307 | uint8_t vdev_id = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4308 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4309 | if (!pe_session) { |
Pragaspathi Thilagaraj | 683c1cf | 2019-09-23 18:40:57 +0530 | [diff] [blame] | 4310 | pe_err("RRM: Send link report: NULL PE session"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4311 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4312 | } |
| 4313 | |
Pragaspathi Thilagaraj | 683c1cf | 2019-09-23 18:40:57 +0530 | [diff] [blame] | 4314 | vdev_id = pe_session->vdev_id; |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4315 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4316 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4317 | frm.Category.category = ACTION_CATEGORY_RRM; |
Srinivas Girigowda | 395addd | 2019-05-24 14:03:58 -0700 | [diff] [blame] | 4318 | frm.Action.action = RRM_LINK_MEASUREMENT_RPT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4319 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 4320 | |
| 4321 | /* IEEE Std. 802.11 7.3.2.18. for the report element. */ |
| 4322 | /* Even though TPC report an IE, it is represented using fixed fields since it is positioned */ |
| 4323 | /* in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 */ |
| 4324 | /* and frame parser always expects IEs to come after all fixed fields. It is easier to handle */ |
| 4325 | /* such case this way than changing the frame parser. */ |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 4326 | frm.TPCEleID.TPCId = WLAN_ELEMID_TPCREP; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4327 | frm.TPCEleLen.TPCLen = 2; |
| 4328 | frm.TxPower.txPower = pLinkReport->txPower; |
| 4329 | frm.LinkMargin.linkMargin = 0; |
| 4330 | |
| 4331 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 4332 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 4333 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 4334 | frm.RSNI.rsni = pLinkReport->rsni; |
| 4335 | |
| 4336 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4337 | dot11f_get_packed_link_measurement_report_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4338 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4339 | 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] | 4340 | /* We'll fall back on the worst case scenario: */ |
| 4341 | nPayload = sizeof(tDot11fLinkMeasurementReport); |
| 4342 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4343 | pe_warn("There were warnings while calculating the packed size for a Link Report (0x%08x)", |
| 4344 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4345 | } |
| 4346 | |
| 4347 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4348 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4349 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4350 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4351 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4352 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4353 | pe_err("Failed to allocate %d bytes for a Link " |
| 4354 | "Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4355 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4356 | } |
| 4357 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4358 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4359 | |
| 4360 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4361 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4362 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4363 | |
| 4364 | /* Update A3 with the BSSID */ |
| 4365 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4366 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4367 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4368 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4369 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4370 | |
| 4371 | /* Now, we're ready to "pack" the frames */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4372 | nStatus = dot11f_pack_link_measurement_report(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4373 | &frm, |
| 4374 | pFrame + |
| 4375 | sizeof(tSirMacMgmtHdr), |
| 4376 | nPayload, &nPayload); |
| 4377 | |
| 4378 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4379 | pe_err("Failed to pack an Link Report (0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4380 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4381 | /* FIXME - Need to convert to QDF_STATUS */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4382 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4383 | goto returnAfterError; |
| 4384 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4385 | pe_warn("There were warnings while packing Link Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4386 | nStatus); |
| 4387 | } |
| 4388 | |
Pragaspathi Thilagaraj | 683c1cf | 2019-09-23 18:40:57 +0530 | [diff] [blame] | 4389 | pe_warn("RRM: Sending Link Report to %pM on vdev[%d]", peer, vdev_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4390 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4391 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 4392 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 4393 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4394 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4395 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4396 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4397 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4398 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4399 | pPacket, |
| 4400 | (uint16_t) nBytes, |
| 4401 | TXRX_FRM_802_11_MGMT, |
| 4402 | ANI_TXDIR_TODS, |
| 4403 | 7, lim_tx_complete, pFrame, txFlag, |
Pragaspathi Thilagaraj | 683c1cf | 2019-09-23 18:40:57 +0530 | [diff] [blame] | 4404 | vdev_id, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4405 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4406 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4407 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4408 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4409 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4410 | /* Pkt will be freed up by the callback */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4411 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4412 | } else |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4413 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4414 | |
| 4415 | returnAfterError: |
| 4416 | cds_packet_free((void *)pPacket); |
| 4417 | |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4418 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4419 | } /* End lim_send_link_report_action_frame. */ |
| 4420 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4421 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4422 | lim_send_radio_measure_report_action_frame(struct mac_context *mac, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4423 | uint8_t dialog_token, |
| 4424 | uint8_t num_report, |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 4425 | bool is_last_frame, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4426 | tpSirMacRadioMeasureReport pRRMReport, |
| 4427 | tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4428 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4429 | { |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4430 | QDF_STATUS status_code = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4431 | uint8_t *pFrame; |
| 4432 | tpSirMacMgmtHdr pMacHdr; |
| 4433 | uint32_t nBytes, nPayload, nStatus; |
| 4434 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4435 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4436 | uint8_t i; |
| 4437 | uint8_t txFlag = 0; |
| 4438 | uint8_t smeSessionId = 0; |
Vignesh Viswanathan | 793328d | 2018-11-02 11:32:35 +0530 | [diff] [blame] | 4439 | bool is_last_report = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4440 | |
| 4441 | tDot11fRadioMeasurementReport *frm = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4442 | qdf_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 4443 | if (!frm) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4444 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4445 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4446 | if (!pe_session) { |
| 4447 | pe_err("(!psession) in Request to send Beacon Report action frame"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4448 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4449 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4450 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4451 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4452 | smeSessionId = pe_session->smeSessionId; |
Deepak Dhamdhere | 6a02148 | 2017-04-20 17:59:58 -0700 | [diff] [blame] | 4453 | |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 4454 | pe_debug("dialog_token %d num_report %d is_last_frame %d", |
| 4455 | dialog_token, num_report, is_last_frame); |
Padma, Santhosh Kumar | 93ec7d2 | 2016-12-26 15:58:37 +0530 | [diff] [blame] | 4456 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4457 | frm->Category.category = ACTION_CATEGORY_RRM; |
Srinivas Girigowda | 395addd | 2019-05-24 14:03:58 -0700 | [diff] [blame] | 4458 | frm->Action.action = RRM_RADIO_MEASURE_RPT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4459 | frm->DialogToken.token = dialog_token; |
| 4460 | |
| 4461 | frm->num_MeasurementReport = |
| 4462 | (num_report > |
| 4463 | RADIO_REPORTS_MAX_IN_A_FRAME) ? RADIO_REPORTS_MAX_IN_A_FRAME : |
| 4464 | num_report; |
| 4465 | |
| 4466 | for (i = 0; i < frm->num_MeasurementReport; i++) { |
| 4467 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 4468 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 4469 | frm->MeasurementReport[i].late = 0; /* IEEE 802.11k section 7.3.22. (always zero in rrm) */ |
| 4470 | switch (pRRMReport[i].type) { |
| 4471 | case SIR_MAC_RRM_BEACON_TYPE: |
Vignesh Viswanathan | 793328d | 2018-11-02 11:32:35 +0530 | [diff] [blame] | 4472 | /* |
| 4473 | * Last beacon report indication needs to be set to 1 |
| 4474 | * only for the last report in the last frame |
| 4475 | */ |
| 4476 | if (is_last_frame && |
| 4477 | (i == (frm->num_MeasurementReport - 1))) |
| 4478 | is_last_report = true; |
| 4479 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4480 | populate_dot11f_beacon_report(mac, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4481 | &frm->MeasurementReport[i], |
| 4482 | &pRRMReport[i].report. |
| 4483 | beaconReport, |
Vignesh Viswanathan | 793328d | 2018-11-02 11:32:35 +0530 | [diff] [blame] | 4484 | is_last_report); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4485 | frm->MeasurementReport[i].incapable = |
| 4486 | pRRMReport[i].incapable; |
| 4487 | frm->MeasurementReport[i].refused = |
| 4488 | pRRMReport[i].refused; |
| 4489 | frm->MeasurementReport[i].present = 1; |
| 4490 | break; |
| 4491 | default: |
| 4492 | frm->MeasurementReport[i].incapable = |
| 4493 | pRRMReport[i].incapable; |
| 4494 | frm->MeasurementReport[i].refused = |
| 4495 | pRRMReport[i].refused; |
| 4496 | frm->MeasurementReport[i].present = 1; |
| 4497 | break; |
| 4498 | } |
| 4499 | } |
| 4500 | |
| 4501 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4502 | dot11f_get_packed_radio_measurement_report_size(mac, frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4503 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4504 | 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] | 4505 | nStatus); |
| 4506 | /* We'll fall back on the worst case scenario: */ |
| 4507 | nPayload = sizeof(tDot11fLinkMeasurementReport); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4508 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4509 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4510 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4511 | pe_warn("There were warnings while calculating the packed size for a Radio Measure Report (0x%08x)", |
| 4512 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4513 | } |
| 4514 | |
| 4515 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4516 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4517 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4518 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4519 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4520 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4521 | pe_err("Failed to allocate %d bytes for a Radio Measure " |
| 4522 | "Report", nBytes); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4523 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4524 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4525 | } |
| 4526 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4527 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4528 | |
| 4529 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4530 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4531 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4532 | |
| 4533 | /* Update A3 with the BSSID */ |
| 4534 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4535 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4536 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4537 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4538 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4539 | |
| 4540 | /* Now, we're ready to "pack" the frames */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4541 | nStatus = dot11f_pack_radio_measurement_report(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4542 | frm, |
| 4543 | pFrame + |
| 4544 | sizeof(tSirMacMgmtHdr), |
| 4545 | nPayload, &nPayload); |
| 4546 | |
| 4547 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4548 | pe_err("Failed to pack an Radio Measure Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4549 | nStatus); |
| 4550 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4551 | /* FIXME - Need to convert to QDF_STATUS */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4552 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4553 | goto returnAfterError; |
| 4554 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4555 | pe_warn("There were warnings while packing Radio Measure Report (0x%08x)", |
| 4556 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4557 | } |
| 4558 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4559 | pe_warn("Sending a Radio Measure Report to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4560 | lim_print_mac_addr(mac, peer, LOGW); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4561 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4562 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 4563 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 4564 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4565 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4566 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4567 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4568 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4569 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4570 | pPacket, |
| 4571 | (uint16_t) nBytes, |
| 4572 | TXRX_FRM_802_11_MGMT, |
| 4573 | ANI_TXDIR_TODS, |
| 4574 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4575 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4576 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4577 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4578 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4579 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4580 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4581 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4582 | qdf_mem_free(frm); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4583 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4584 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4585 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4586 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4587 | } |
| 4588 | |
| 4589 | returnAfterError: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4590 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4591 | cds_packet_free((void *)pPacket); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4592 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4593 | } |
| 4594 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4595 | #ifdef WLAN_FEATURE_11W |
| 4596 | /** |
| 4597 | * \brief Send SA query request action frame to peer |
| 4598 | * |
| 4599 | * \sa lim_send_sa_query_request_frame |
| 4600 | * |
| 4601 | * |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4602 | * \param mac The global struct mac_context *object |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4603 | * |
| 4604 | * \param transId Transaction identifier |
| 4605 | * |
| 4606 | * \param peer The Mac address of the station to which this action frame is addressed |
| 4607 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4608 | * \param pe_session The PE session entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4609 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4610 | * \return QDF_STATUS_SUCCESS if setup completes successfully |
| 4611 | * QDF_STATUS_E_FAILURE is some problem is encountered |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4612 | */ |
| 4613 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4614 | 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] | 4615 | tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4616 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4617 | { |
| 4618 | |
| 4619 | tDot11fSaQueryReq frm; /* SA query request action frame */ |
| 4620 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4621 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4622 | tpSirMacMgmtHdr pMacHdr; |
| 4623 | uint32_t nBytes, nPayload, nStatus; |
| 4624 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4625 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4626 | uint8_t txFlag = 0; |
| 4627 | uint8_t smeSessionId = 0; |
| 4628 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4629 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4630 | frm.Category.category = ACTION_CATEGORY_SA_QUERY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4631 | /* 11w action field is : |
| 4632 | action: 0 --> SA Query Request action frame |
| 4633 | action: 1 --> SA Query Response action frame */ |
Srinivas Girigowda | feb23fc | 2019-06-13 11:12:29 -0700 | [diff] [blame] | 4634 | frm.Action.action = SA_QUERY_REQUEST; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4635 | /* 11w SA Query Request transId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4636 | qdf_mem_copy(&frm.TransactionId.transId[0], &transId[0], 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4637 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4638 | nStatus = dot11f_get_packed_sa_query_req_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4639 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4640 | 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] | 4641 | nStatus); |
| 4642 | /* We'll fall back on the worst case scenario: */ |
| 4643 | nPayload = sizeof(tDot11fSaQueryReq); |
| 4644 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4645 | pe_warn("There were warnings while calculating the packed size for an SA Query Request (0x%08x)", |
| 4646 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4647 | } |
| 4648 | |
| 4649 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4650 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4651 | cds_packet_alloc(nBytes, (void **)&pFrame, (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4652 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4653 | pe_err("Failed to allocate %d bytes for a SA Query Request " |
| 4654 | "action frame", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4655 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4656 | } |
| 4657 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4658 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4659 | |
| 4660 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4661 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4662 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4663 | |
| 4664 | /* Update A3 with the BSSID */ |
| 4665 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4666 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4667 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4668 | |
| 4669 | /* Since this is a SA Query Request, set the "protect" (aka WEP) bit */ |
| 4670 | /* in the FC */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4671 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4672 | |
| 4673 | /* Pack 11w SA Query Request frame */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4674 | nStatus = dot11f_pack_sa_query_req(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4675 | &frm, |
| 4676 | pFrame + sizeof(tSirMacMgmtHdr), |
| 4677 | nPayload, &nPayload); |
| 4678 | |
| 4679 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4680 | pe_err("Failed to pack an SA Query Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4681 | nStatus); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4682 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4683 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4684 | goto returnAfterError; |
| 4685 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4686 | pe_warn("There were warnings while packing SA Query Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4687 | nStatus); |
| 4688 | } |
| 4689 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4690 | pe_debug("Sending an SA Query Request to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4691 | lim_print_mac_addr(mac, peer, LOGD); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4692 | pe_debug("Sending an SA Query Request from "); |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4693 | lim_print_mac_addr(mac, pe_session->self_mac_addr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4694 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4695 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 4696 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 4697 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4698 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 4699 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4700 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4701 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4702 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4703 | pPacket, |
| 4704 | (uint16_t) nBytes, |
| 4705 | TXRX_FRM_802_11_MGMT, |
| 4706 | ANI_TXDIR_TODS, |
| 4707 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4708 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4709 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4710 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4711 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4712 | /* Pkt will be freed up by the callback */ |
| 4713 | return nSirStatus; |
| 4714 | } else { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4715 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4716 | } |
| 4717 | |
| 4718 | returnAfterError: |
| 4719 | cds_packet_free((void *)pPacket); |
| 4720 | return nSirStatus; |
| 4721 | } /* End lim_send_sa_query_request_frame */ |
| 4722 | |
| 4723 | /** |
| 4724 | * \brief Send SA query response action frame to peer |
| 4725 | * |
| 4726 | * \sa lim_send_sa_query_response_frame |
| 4727 | * |
| 4728 | * |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4729 | * \param mac The global struct mac_context *object |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4730 | * |
| 4731 | * \param transId Transaction identifier received in SA query request action frame |
| 4732 | * |
| 4733 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 4734 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4735 | * \param pe_session The PE session entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4736 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4737 | * \return QDF_STATUS_SUCCESS if setup completes successfully |
| 4738 | * QDF_STATUS_E_FAILURE is some problem is encountered |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4739 | */ |
| 4740 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4741 | QDF_STATUS lim_send_sa_query_response_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4742 | uint8_t *transId, tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4743 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4744 | { |
| 4745 | |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 4746 | tDot11fSaQueryRsp frm; /* SA query response action frame */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4747 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4748 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4749 | tpSirMacMgmtHdr pMacHdr; |
| 4750 | uint32_t nBytes, nPayload, nStatus; |
| 4751 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4752 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4753 | uint8_t txFlag = 0; |
| 4754 | uint8_t smeSessionId = 0; |
| 4755 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4756 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4757 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4758 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4759 | frm.Category.category = ACTION_CATEGORY_SA_QUERY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4760 | /*11w action field is : |
| 4761 | action: 0 --> SA query request action frame |
| 4762 | action: 1 --> SA query response action frame */ |
Srinivas Girigowda | feb23fc | 2019-06-13 11:12:29 -0700 | [diff] [blame] | 4763 | frm.Action.action = SA_QUERY_RESPONSE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4764 | /*11w SA query response transId is same as |
| 4765 | SA query request transId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4766 | qdf_mem_copy(&frm.TransactionId.transId[0], &transId[0], 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4767 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4768 | nStatus = dot11f_get_packed_sa_query_rsp_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4769 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4770 | 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] | 4771 | nStatus); |
| 4772 | /* We'll fall back on the worst case scenario: */ |
| 4773 | nPayload = sizeof(tDot11fSaQueryRsp); |
| 4774 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4775 | pe_warn("There were warnings while calculating the packed size for an SA Query Response (0x%08x)", |
| 4776 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4777 | } |
| 4778 | |
| 4779 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4780 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4781 | cds_packet_alloc(nBytes, (void **)&pFrame, (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4782 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4783 | pe_err("Failed to allocate %d bytes for a SA query response" |
| 4784 | " action frame", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4785 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4786 | } |
| 4787 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4788 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4789 | |
| 4790 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4791 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4792 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4793 | |
| 4794 | /* Update A3 with the BSSID */ |
| 4795 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4796 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4797 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4798 | |
| 4799 | /* Since this is a SA Query Response, set the "protect" (aka WEP) bit */ |
| 4800 | /* in the FC */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4801 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4802 | |
| 4803 | /* Pack 11w SA query response frame */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4804 | nStatus = dot11f_pack_sa_query_rsp(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4805 | &frm, |
| 4806 | pFrame + sizeof(tSirMacMgmtHdr), |
| 4807 | nPayload, &nPayload); |
| 4808 | |
| 4809 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4810 | pe_err("Failed to pack an SA Query Response (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4811 | nStatus); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4812 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4813 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4814 | goto returnAfterError; |
| 4815 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4816 | pe_warn("There were warnings while packing SA Query Response (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4817 | nStatus); |
| 4818 | } |
| 4819 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4820 | pe_debug("Sending a SA Query Response to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4821 | lim_print_mac_addr(mac, peer, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4822 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4823 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 4824 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 4825 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4826 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4827 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4828 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4829 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4830 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4831 | pPacket, |
| 4832 | (uint16_t) nBytes, |
| 4833 | TXRX_FRM_802_11_MGMT, |
| 4834 | ANI_TXDIR_TODS, |
| 4835 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4836 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4837 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4838 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4839 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4840 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4841 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4842 | /* Pkt will be freed up by the callback */ |
| 4843 | return nSirStatus; |
| 4844 | } else { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4845 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4846 | } |
| 4847 | |
| 4848 | returnAfterError: |
| 4849 | cds_packet_free((void *)pPacket); |
| 4850 | return nSirStatus; |
| 4851 | } /* End lim_send_sa_query_response_frame */ |
| 4852 | #endif |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4853 | |
Manjunathappa Prakash | 458f6fe | 2019-05-13 18:33:01 -0700 | [diff] [blame^] | 4854 | #if defined(QCA_WIFI_QCA6290) || defined(QCA_WIFI_QCA6390) || \ |
| 4855 | defined(QCA_WIFI_QCA6490) |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4856 | #ifdef WLAN_FEATURE_11AX |
Kiran Kumar Lokere | 9d80ef6 | 2019-10-15 17:02:49 -0700 | [diff] [blame] | 4857 | #define IS_PE_SESSION_HE_MODE(_session) ((_session)->he_capable) |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4858 | #else |
Kiran Kumar Lokere | 9d80ef6 | 2019-10-15 17:02:49 -0700 | [diff] [blame] | 4859 | #define IS_PE_SESSION_HE_MODE(_session) false |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4860 | #endif /* WLAN_FEATURE_11AX */ |
| 4861 | #else |
Kiran Kumar Lokere | 9d80ef6 | 2019-10-15 17:02:49 -0700 | [diff] [blame] | 4862 | #define IS_PE_SESSION_HE_MODE(_session) false |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4863 | #endif |
| 4864 | |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4865 | /** |
| 4866 | * lim_send_addba_response_frame(): Send ADDBA response action frame to peer |
| 4867 | * @mac_ctx: mac context |
| 4868 | * @peer_mac: Peer MAC address |
| 4869 | * @tid: TID for which addba response is being sent |
| 4870 | * @session: PE session entry |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4871 | * @addba_extn_present: ADDBA extension present flag |
Kiran Kumar Lokere | aee823a | 2018-03-22 15:27:05 -0700 | [diff] [blame] | 4872 | * @amsdu_support: amsdu in ampdu support |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4873 | * |
| 4874 | * This function is called when ADDBA request is successful. ADDBA response is |
| 4875 | * setup by calling addba_response_setup API and frame is then sent out OTA. |
| 4876 | * |
| 4877 | * Return: QDF_STATUS |
| 4878 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4879 | 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] | 4880 | tSirMacAddr peer_mac, uint16_t tid, |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 4881 | struct pe_session *session, uint8_t addba_extn_present, |
Kiran Kumar Lokere | aee823a | 2018-03-22 15:27:05 -0700 | [diff] [blame] | 4882 | uint8_t amsdu_support) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4883 | { |
| 4884 | |
| 4885 | tDot11faddba_rsp frm; |
| 4886 | uint8_t *frame_ptr; |
| 4887 | tpSirMacMgmtHdr mgmt_hdr; |
| 4888 | uint32_t num_bytes, payload_size, status; |
Sandeep Puligilla | 39cec08 | 2018-04-30 15:18:45 -0700 | [diff] [blame] | 4889 | void *pkt_ptr = NULL; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4890 | QDF_STATUS qdf_status; |
| 4891 | uint8_t tx_flag = 0; |
| 4892 | uint8_t sme_sessionid = 0; |
| 4893 | uint16_t buff_size, status_code, batimeout; |
| 4894 | uint8_t peer_id, dialog_token; |
| 4895 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 4896 | void *peer, *pdev; |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4897 | uint8_t he_frag = 0; |
Yu Wang | 36d5210 | 2019-09-20 12:08:04 +0800 | [diff] [blame] | 4898 | tpDphHashNode sta_ds; |
| 4899 | uint16_t aid; |
| 4900 | bool he_cap = false; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4901 | |
| 4902 | sme_sessionid = session->smeSessionId; |
| 4903 | |
| 4904 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 4905 | if (!pdev) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4906 | pe_err("pdev is NULL"); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4907 | return QDF_STATUS_E_FAILURE; |
| 4908 | } |
| 4909 | |
Mohit Khanna | c4c2225 | 2017-11-20 11:06:33 -0800 | [diff] [blame] | 4910 | peer = cdp_peer_get_ref_by_addr(soc, pdev, peer_mac, &peer_id, |
| 4911 | PEER_DEBUG_ID_LIM_SEND_ADDBA_RESP); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4912 | if (!peer) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4913 | pe_err("PEER [%pM] not found", peer_mac); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4914 | return QDF_STATUS_E_FAILURE; |
| 4915 | } |
| 4916 | |
| 4917 | cdp_addba_responsesetup(soc, peer, tid, &dialog_token, |
| 4918 | &status_code, &buff_size, &batimeout); |
| 4919 | |
Mohit Khanna | c4c2225 | 2017-11-20 11:06:33 -0800 | [diff] [blame] | 4920 | cdp_peer_release_ref(soc, peer, PEER_DEBUG_ID_LIM_SEND_ADDBA_RESP); |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4921 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4922 | frm.Category.category = ACTION_CATEGORY_BACK; |
Srinivas Girigowda | ef0d714 | 2019-05-17 17:07:47 -0700 | [diff] [blame] | 4923 | frm.Action.action = ADDBA_RESPONSE; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4924 | |
| 4925 | frm.DialogToken.token = dialog_token; |
| 4926 | frm.Status.status = status_code; |
Kiran Kumar Lokere | 08195ef | 2018-01-17 19:25:15 -0800 | [diff] [blame] | 4927 | if (mac_ctx->reject_addba_req) { |
| 4928 | frm.Status.status = eSIR_MAC_REQ_DECLINED_STATUS; |
| 4929 | pe_err("refused addba req"); |
| 4930 | } |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4931 | frm.addba_param_set.tid = tid; |
Yu Wang | 36d5210 | 2019-09-20 12:08:04 +0800 | [diff] [blame] | 4932 | |
| 4933 | if (lim_is_session_he_capable(session)) { |
| 4934 | sta_ds = dph_lookup_hash_entry(mac_ctx, peer_mac, &aid, |
| 4935 | &session->dph.dphHashTable); |
| 4936 | if (sta_ds) |
| 4937 | he_cap = lim_is_sta_he_capable(sta_ds); |
| 4938 | } |
| 4939 | |
| 4940 | if (he_cap) |
Kiran Kumar Lokere | 22f05d4 | 2019-06-28 18:33:43 -0700 | [diff] [blame] | 4941 | frm.addba_param_set.buff_size = MAX_BA_BUFF_SIZE; |
| 4942 | else |
| 4943 | frm.addba_param_set.buff_size = SIR_MAC_BA_DEFAULT_BUFF_SIZE; |
Yu Wang | 36d5210 | 2019-09-20 12:08:04 +0800 | [diff] [blame] | 4944 | |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 4945 | if (mac_ctx->usr_cfg_ba_buff_size) |
| 4946 | 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] | 4947 | |
| 4948 | if (frm.addba_param_set.buff_size > MAX_BA_BUFF_SIZE) |
| 4949 | frm.addba_param_set.buff_size = MAX_BA_BUFF_SIZE; |
| 4950 | |
| 4951 | if (frm.addba_param_set.buff_size > SIR_MAC_BA_DEFAULT_BUFF_SIZE) { |
| 4952 | if (session->active_ba_64_session) { |
| 4953 | frm.addba_param_set.buff_size = |
| 4954 | SIR_MAC_BA_DEFAULT_BUFF_SIZE; |
| 4955 | } |
| 4956 | } else if (!session->active_ba_64_session) { |
| 4957 | session->active_ba_64_session = true; |
| 4958 | } |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4959 | |
Kiran Kumar Lokere | 9d80ef6 | 2019-10-15 17:02:49 -0700 | [diff] [blame] | 4960 | /* Enable RX AMSDU only in HE mode if supported */ |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4961 | if (mac_ctx->is_usr_cfg_amsdu_enabled && |
Kiran Kumar Lokere | 9d80ef6 | 2019-10-15 17:02:49 -0700 | [diff] [blame] | 4962 | ((IS_PE_SESSION_HE_MODE(session) && |
| 4963 | WLAN_REG_IS_24GHZ_CH_FREQ(session->curr_op_freq)) || |
| 4964 | WLAN_REG_IS_5GHZ_CH_FREQ(session->curr_op_freq))) |
Arif Hussain | 0e24680 | 2018-05-01 18:13:44 -0700 | [diff] [blame] | 4965 | frm.addba_param_set.amsdu_supp = amsdu_support; |
| 4966 | else |
| 4967 | frm.addba_param_set.amsdu_supp = 0; |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4968 | |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 4969 | frm.addba_param_set.policy = SIR_MAC_BA_POLICY_IMMEDIATE; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4970 | frm.ba_timeout.timeout = batimeout; |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4971 | if (addba_extn_present) { |
| 4972 | frm.addba_extn_element.present = 1; |
| 4973 | frm.addba_extn_element.no_fragmentation = 1; |
| 4974 | if (lim_is_session_he_capable(session)) { |
| 4975 | he_frag = lim_get_session_he_frag_cap(session); |
| 4976 | if (he_frag != 0) { |
| 4977 | frm.addba_extn_element.no_fragmentation = 0; |
| 4978 | frm.addba_extn_element.he_frag_operation = |
| 4979 | he_frag; |
| 4980 | } |
| 4981 | } |
| 4982 | } |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4983 | |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4984 | pe_debug("Sending a ADDBA Response from %pM to %pM", |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4985 | session->self_mac_addr, peer_mac); |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4986 | 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] | 4987 | tid, frm.DialogToken.token, frm.Status.status, |
| 4988 | frm.addba_param_set.buff_size); |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4989 | pe_debug("addba_extn %d he_capable %d no_frag %d he_frag %d", |
| 4990 | addba_extn_present, |
| 4991 | lim_is_session_he_capable(session), |
| 4992 | frm.addba_extn_element.no_fragmentation, |
| 4993 | frm.addba_extn_element.he_frag_operation); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4994 | |
| 4995 | status = dot11f_get_packed_addba_rsp_size(mac_ctx, &frm, &payload_size); |
| 4996 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4997 | 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] | 4998 | status); |
| 4999 | /* We'll fall back on the worst case scenario: */ |
| 5000 | payload_size = sizeof(tDot11faddba_rsp); |
| 5001 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 5002 | 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] | 5003 | } |
| 5004 | |
| 5005 | num_bytes = payload_size + sizeof(*mgmt_hdr); |
| 5006 | qdf_status = cds_packet_alloc(num_bytes, (void **)&frame_ptr, |
| 5007 | (void **)&pkt_ptr); |
Sandeep Puligilla | 39cec08 | 2018-04-30 15:18:45 -0700 | [diff] [blame] | 5008 | if (!QDF_IS_STATUS_SUCCESS(qdf_status) || (!pkt_ptr)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 5009 | pe_err("Failed to allocate %d bytes for a ADDBA response action frame", |
| 5010 | num_bytes); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5011 | return QDF_STATUS_E_FAILURE; |
| 5012 | } |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 5013 | qdf_mem_zero(frame_ptr, num_bytes); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5014 | |
| 5015 | lim_populate_mac_header(mac_ctx, frame_ptr, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 5016 | SIR_MAC_MGMT_ACTION, peer_mac, session->self_mac_addr); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5017 | |
| 5018 | /* Update A3 with the BSSID */ |
| 5019 | mgmt_hdr = (tpSirMacMgmtHdr) frame_ptr; |
| 5020 | sir_copy_mac_addr(mgmt_hdr->bssId, session->bssId); |
| 5021 | |
| 5022 | /* ADDBA Response is a robust mgmt action frame, |
| 5023 | * set the "protect" (aka WEP) bit in the FC |
| 5024 | */ |
| 5025 | lim_set_protected_bit(mac_ctx, session, peer_mac, mgmt_hdr); |
| 5026 | |
| 5027 | status = dot11f_pack_addba_rsp(mac_ctx, &frm, |
| 5028 | frame_ptr + sizeof(tSirMacMgmtHdr), payload_size, |
| 5029 | &payload_size); |
| 5030 | |
| 5031 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 5032 | pe_err("Failed to pack a ADDBA Response (0x%08x)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5033 | status); |
| 5034 | qdf_status = QDF_STATUS_E_FAILURE; |
| 5035 | goto error_addba_rsp; |
| 5036 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 5037 | pe_warn("There were warnings while packing ADDBA Response (0x%08x)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5038 | status); |
| 5039 | } |
| 5040 | |
| 5041 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 5042 | if (wlan_reg_is_5ghz_ch_freq(session->curr_op_freq) || |
| 5043 | session->opmode == QDF_P2P_CLIENT_MODE || |
| 5044 | session->opmode == QDF_P2P_GO_MODE) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5045 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5046 | |
| 5047 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
| 5048 | session->peSessionId, mgmt_hdr->fc.subType)); |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 5049 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, pkt_ptr, |
| 5050 | (uint16_t)num_bytes, |
| 5051 | TXRX_FRM_802_11_MGMT, |
| 5052 | ANI_TXDIR_TODS, 7, |
| 5053 | NULL, frame_ptr, |
| 5054 | lim_addba_rsp_tx_complete_cnf, |
| 5055 | tx_flag, sme_sessionid, |
| 5056 | false, 0, RATEID_DEFAULT); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5057 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 5058 | session->peSessionId, qdf_status)); |
| 5059 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 5060 | pe_err("wma_tx_frame FAILED! Status [%d]", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5061 | qdf_status); |
chenguo | 90c6846 | 2019-01-24 18:27:01 +0800 | [diff] [blame] | 5062 | return QDF_STATUS_E_FAILURE; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5063 | } else { |
Tushnim Bhattacharyya | d58e4c9 | 2018-03-27 13:40:12 -0700 | [diff] [blame] | 5064 | return QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5065 | } |
| 5066 | |
| 5067 | error_addba_rsp: |
| 5068 | cds_packet_free((void *)pkt_ptr); |
| 5069 | return qdf_status; |
| 5070 | } |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5071 | |
| 5072 | /** |
| 5073 | * lim_tx_mgmt_frame() - Transmits Auth mgmt frame |
| 5074 | * @mac_ctx Pointer to Global MAC structure |
| 5075 | * @mb_msg: Received message info |
| 5076 | * @msg_len: Received message length |
| 5077 | * @packet: Packet to be transmitted |
| 5078 | * @frame: Received frame |
| 5079 | * |
| 5080 | * Return: None |
| 5081 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 5082 | static void lim_tx_mgmt_frame(struct mac_context *mac_ctx, |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5083 | struct sir_mgmt_msg *mb_msg, uint32_t msg_len, |
| 5084 | void *packet, uint8_t *frame) |
| 5085 | { |
| 5086 | tpSirMacFrameCtl fc = (tpSirMacFrameCtl) mb_msg->data; |
| 5087 | QDF_STATUS qdf_status; |
Abhishek Singh | efe21e6 | 2019-09-20 10:03:24 +0530 | [diff] [blame] | 5088 | uint8_t vdev_id = 0; |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 5089 | struct pe_session *session; |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5090 | uint16_t auth_ack_status; |
| 5091 | enum rateid min_rid = RATEID_DEFAULT; |
| 5092 | |
Abhishek Singh | efe21e6 | 2019-09-20 10:03:24 +0530 | [diff] [blame] | 5093 | vdev_id = mb_msg->session_id; |
| 5094 | session = pe_find_session_by_vdev_id(mac_ctx, vdev_id); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 5095 | if (!session) { |
Wu Gao | 7c0a23f | 2019-03-12 14:16:37 +0800 | [diff] [blame] | 5096 | cds_packet_free((void *)packet); |
Abhishek Singh | efe21e6 | 2019-09-20 10:03:24 +0530 | [diff] [blame] | 5097 | pe_err("session not found for given vdev_id %d", |
| 5098 | vdev_id); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5099 | return; |
| 5100 | } |
| 5101 | |
Ashish Kumar Dhanotiya | 9f72df0 | 2018-07-23 19:20:04 +0530 | [diff] [blame] | 5102 | qdf_mtrace(QDF_MODULE_ID_PE, QDF_MODULE_ID_WMA, TRACE_CODE_TX_MGMT, |
| 5103 | session->peSessionId, 0); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5104 | |
| 5105 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_NOT_RCD; |
| 5106 | min_rid = lim_get_min_session_txrate(session); |
| 5107 | |
| 5108 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 5109 | (uint16_t)msg_len, |
| 5110 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 5111 | 7, lim_tx_complete, frame, |
| 5112 | lim_auth_tx_complete_cnf, |
Abhishek Singh | efe21e6 | 2019-09-20 10:03:24 +0530 | [diff] [blame] | 5113 | 0, vdev_id, false, 0, min_rid); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5114 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 5115 | session->peSessionId, qdf_status)); |
| 5116 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Rachit Kankane | 0baf6e7 | 2018-01-19 15:01:50 +0530 | [diff] [blame] | 5117 | pe_err("*** Could not send Auth frame (subType: %d), retCode=%X ***", |
| 5118 | fc->subType, qdf_status); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5119 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
| 5120 | auth_ack_status = SENT_FAIL; |
| 5121 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 5122 | session, auth_ack_status, QDF_STATUS_E_FAILURE); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5123 | /* Pkt will be freed up by the callback */ |
| 5124 | } |
| 5125 | } |
| 5126 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 5127 | void lim_send_mgmt_frame_tx(struct mac_context *mac_ctx, |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5128 | struct scheduler_msg *msg) |
| 5129 | { |
| 5130 | struct sir_mgmt_msg *mb_msg = (struct sir_mgmt_msg *)msg->bodyptr; |
| 5131 | uint32_t msg_len; |
| 5132 | tpSirMacFrameCtl fc = (tpSirMacFrameCtl) mb_msg->data; |
| 5133 | uint8_t sme_session_id; |
| 5134 | QDF_STATUS qdf_status; |
| 5135 | uint8_t *frame; |
| 5136 | void *packet; |
Srinivas Dasari | 7621849 | 2019-01-22 15:08:20 +0530 | [diff] [blame] | 5137 | tpSirMacMgmtHdr mac_hdr; |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5138 | |
| 5139 | msg_len = mb_msg->msg_len - sizeof(*mb_msg); |
| 5140 | pe_debug("sending fc->type: %d fc->subType: %d", |
| 5141 | fc->type, fc->subType); |
| 5142 | |
| 5143 | sme_session_id = mb_msg->session_id; |
Srinivas Dasari | 7621849 | 2019-01-22 15:08:20 +0530 | [diff] [blame] | 5144 | mac_hdr = (tpSirMacMgmtHdr)mb_msg->data; |
| 5145 | |
| 5146 | lim_add_mgmt_seq_num(mac_ctx, mac_hdr); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5147 | |
| 5148 | qdf_status = cds_packet_alloc((uint16_t) msg_len, (void **)&frame, |
| 5149 | (void **)&packet); |
| 5150 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 5151 | pe_err("call to bufAlloc failed for AUTH frame"); |
| 5152 | return; |
| 5153 | } |
| 5154 | |
| 5155 | qdf_mem_copy(frame, mb_msg->data, msg_len); |
| 5156 | |
| 5157 | lim_tx_mgmt_frame(mac_ctx, mb_msg, msg_len, packet, frame); |
| 5158 | } |