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