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