Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Rajasekaran Kalidoss | 7152a35 | 2018-11-19 09:58:35 +0530 | [diff] [blame] | 2 | * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | /** |
| 20 | * \file lim_send_management_frames.c |
| 21 | * |
| 22 | * \brief Code for preparing and sending 802.11 Management frames |
| 23 | * |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | #include "sir_api.h" |
| 28 | #include "ani_global.h" |
| 29 | #include "sir_mac_prot_def.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 30 | #include "utils_api.h" |
| 31 | #include "lim_types.h" |
| 32 | #include "lim_utils.h" |
| 33 | #include "lim_security_utils.h" |
| 34 | #include "lim_prop_exts_utils.h" |
| 35 | #include "dot11f.h" |
| 36 | #include "lim_sta_hash_api.h" |
| 37 | #include "sch_api.h" |
| 38 | #include "lim_send_messages.h" |
| 39 | #include "lim_assoc_utils.h" |
| 40 | #include "lim_ft.h" |
| 41 | #ifdef WLAN_FEATURE_11W |
| 42 | #include "wni_cfg.h" |
| 43 | #endif |
| 44 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 45 | #include "lim_ft_defs.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 46 | #include "lim_session.h" |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 47 | #include "qdf_types.h" |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 48 | #include "qdf_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 49 | #include "cds_utils.h" |
| 50 | #include "sme_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 51 | #include "rrm_api.h" |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 52 | #include "qdf_crypto.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 53 | |
| 54 | #include "wma_types.h" |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 55 | #include <cdp_txrx_cmn.h> |
Tushnim Bhattacharyya | 45ed04f | 2017-03-15 10:15:05 -0700 | [diff] [blame] | 56 | #include <cdp_txrx_peer_ops.h> |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 57 | #include "lim_process_fils.h" |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 58 | #include "wlan_utility.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 59 | |
| 60 | /** |
| 61 | * |
| 62 | * \brief This function is called to add the sequence number to the |
| 63 | * management frames |
| 64 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 65 | * \param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 66 | * |
| 67 | * \param pMacHdr Pointer to MAC management header |
| 68 | * |
| 69 | * The pMacHdr argument points to the MAC management header. The |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 70 | * sequence number stored in the mac structure will be incremented |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 71 | * and updated to the MAC management header. The start sequence |
| 72 | * number is WLAN_HOST_SEQ_NUM_MIN and the end value is |
| 73 | * WLAN_HOST_SEQ_NUM_MAX. After reaching the MAX value, the sequence |
| 74 | * number will roll over. |
| 75 | * |
| 76 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 77 | static void lim_add_mgmt_seq_num(struct mac_context *mac, tpSirMacMgmtHdr pMacHdr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 78 | { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 79 | if (mac->mgmtSeqNum >= WLAN_HOST_SEQ_NUM_MAX) { |
| 80 | mac->mgmtSeqNum = WLAN_HOST_SEQ_NUM_MIN - 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 81 | } |
| 82 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 83 | mac->mgmtSeqNum++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 84 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 85 | pMacHdr->seqControl.seqNumLo = (mac->mgmtSeqNum & LOW_SEQ_NUM_MASK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 86 | pMacHdr->seqControl.seqNumHi = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 87 | ((mac->mgmtSeqNum & HIGH_SEQ_NUM_MASK) >> HIGH_SEQ_NUM_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 91 | * lim_populate_mac_header() - Fill in 802.11 header of frame |
| 92 | * |
| 93 | * @mac_ctx: Pointer to Global MAC structure |
| 94 | * @buf: Pointer to the frame buffer that needs to be populate |
| 95 | * @type: 802.11 Type of the frame |
| 96 | * @sub_type: 802.11 Subtype of the frame |
| 97 | * @peer_addr: dst address |
| 98 | * @self_mac_addr: local mac address |
| 99 | * |
| 100 | * This function is called by various LIM modules to prepare the |
| 101 | * 802.11 frame MAC header |
| 102 | * |
| 103 | * The buf argument points to the beginning of the frame buffer to |
| 104 | * which - a) The 802.11 MAC header is set b) Following this MAC header |
| 105 | * will be the MGMT frame payload The payload itself is populated by the |
| 106 | * caller API |
| 107 | * |
| 108 | * Return: None |
| 109 | */ |
| 110 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 111 | void lim_populate_mac_header(struct mac_context *mac_ctx, uint8_t *buf, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 112 | uint8_t type, uint8_t sub_type, tSirMacAddr peer_addr, |
| 113 | tSirMacAddr self_mac_addr) |
| 114 | { |
| 115 | tpSirMacMgmtHdr mac_hdr; |
| 116 | |
| 117 | /* Prepare MAC management header */ |
| 118 | mac_hdr = (tpSirMacMgmtHdr) (buf); |
| 119 | |
| 120 | /* Prepare FC */ |
| 121 | mac_hdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 122 | mac_hdr->fc.type = type; |
| 123 | mac_hdr->fc.subType = sub_type; |
| 124 | |
| 125 | /* Prepare Address 1 */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 126 | qdf_mem_copy((uint8_t *) mac_hdr->da, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 127 | (uint8_t *) peer_addr, sizeof(tSirMacAddr)); |
| 128 | |
| 129 | /* Prepare Address 2 */ |
| 130 | sir_copy_mac_addr(mac_hdr->sa, self_mac_addr); |
| 131 | |
| 132 | /* Prepare Address 3 */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 133 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 134 | (uint8_t *) peer_addr, sizeof(tSirMacAddr)); |
| 135 | |
| 136 | /* Prepare sequence number */ |
| 137 | lim_add_mgmt_seq_num(mac_ctx, mac_hdr); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 138 | pe_debug("seqNumLo=%d, seqNumHi=%d, mgmtSeqNum=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 139 | mac_hdr->seqControl.seqNumLo, |
| 140 | mac_hdr->seqControl.seqNumHi, mac_ctx->mgmtSeqNum); |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * lim_send_probe_req_mgmt_frame() - send probe request management frame |
| 145 | * @mac_ctx: Pointer to Global MAC structure |
| 146 | * @ssid: SSID to be sent in Probe Request frame |
| 147 | * @bssid: BSSID to be sent in Probe Request frame |
| 148 | * @channel: Channel # on which the Probe Request is going out |
| 149 | * @self_macaddr: self MAC address |
| 150 | * @dot11mode: self dotllmode |
| 151 | * @additional_ielen: if non-zero, include additional_ie in the Probe Request |
| 152 | * frame |
| 153 | * @additional_ie: if additional_ielen is non zero, include this field in the |
| 154 | * Probe Request frame |
| 155 | * |
| 156 | * This function is called by various LIM modules to send Probe Request frame |
| 157 | * during active scan/learn phase. |
| 158 | * Probe request is sent out in the following scenarios: |
| 159 | * --heartbeat failure: session needed |
| 160 | * --join req: session needed |
| 161 | * --foreground scan: no session |
| 162 | * --background scan: no session |
| 163 | * --sch_beacon_processing: to get EDCA parameters: session needed |
| 164 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 165 | * Return: QDF_STATUS (QDF_STATUS_SUCCESS on success and error codes otherwise) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 166 | */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 167 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 168 | lim_send_probe_req_mgmt_frame(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 169 | tSirMacSSid *ssid, |
| 170 | tSirMacAddr bssid, |
| 171 | uint8_t channel, |
| 172 | tSirMacAddr self_macaddr, |
| 173 | uint32_t dot11mode, |
Jeff Johnson | 919f2c3 | 2019-01-16 11:22:24 -0800 | [diff] [blame] | 174 | uint16_t *additional_ielen, |
| 175 | uint8_t *additional_ie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 176 | { |
| 177 | tDot11fProbeRequest pr; |
| 178 | uint32_t status, bytes, payload; |
| 179 | uint8_t *frame; |
| 180 | void *packet; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 181 | QDF_STATUS qdf_status; |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 182 | struct pe_session *pesession; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 183 | uint8_t sessionid; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 184 | const uint8_t *p2pie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 185 | uint8_t txflag = 0; |
| 186 | uint8_t sme_sessionid = 0; |
| 187 | bool is_vht_enabled = false; |
| 188 | uint8_t txPower; |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 189 | uint16_t addn_ielen = 0; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 190 | bool extracted_ext_cap_flag = false; |
| 191 | tDot11fIEExtCap extracted_ext_cap; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 192 | QDF_STATUS sir_status; |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 193 | const uint8_t *qcn_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 194 | |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 195 | if (additional_ielen) |
| 196 | addn_ielen = *additional_ielen; |
| 197 | |
Jeff Johnson | 919f2c3 | 2019-01-16 11:22:24 -0800 | [diff] [blame] | 198 | /* |
| 199 | * The probe req should not send 11ac capabilities if band is |
| 200 | * 2.4GHz, unless gEnableVhtFor24GHzBand is enabled in INI. So |
| 201 | * if gEnableVhtFor24GHzBand is false and dot11mode is 11ac |
| 202 | * set it to 11n. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 203 | */ |
| 204 | if (channel <= SIR_11B_CHANNEL_END && |
Abhinav Kumar | e057b41 | 2018-10-09 17:28:16 +0530 | [diff] [blame] | 205 | !mac_ctx->mlme_cfg->vht_caps.vht_cap_info.b24ghz_band && |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 206 | (MLME_DOT11_MODE_11AC == dot11mode || |
| 207 | MLME_DOT11_MODE_11AC_ONLY == dot11mode)) |
| 208 | dot11mode = MLME_DOT11_MODE_11N; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 209 | /* |
| 210 | * session context may or may not be present, when probe request needs |
| 211 | * to be sent out. Following cases exist: |
| 212 | * --heartbeat failure: session needed |
| 213 | * --join req: session needed |
| 214 | * --foreground scan: no session |
| 215 | * --background scan: no session |
| 216 | * --sch_beacon_processing: to get EDCA parameters: session needed |
| 217 | * If session context does not exist, some IEs will be populated from |
| 218 | * CFGs, e.g. Supported and Extended rate set IEs |
| 219 | */ |
| 220 | pesession = pe_find_session_by_bssid(mac_ctx, bssid, &sessionid); |
| 221 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 222 | if (pesession) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 223 | sme_sessionid = pesession->smeSessionId; |
| 224 | |
| 225 | /* The scheme here is to fill out a 'tDot11fProbeRequest' structure */ |
| 226 | /* and then hand it off to 'dot11f_pack_probe_request' (for */ |
| 227 | /* serialization). We start by zero-initializing the structure: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 228 | qdf_mem_zero((uint8_t *) &pr, sizeof(pr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 229 | |
| 230 | /* & delegating to assorted helpers: */ |
| 231 | populate_dot11f_ssid(mac_ctx, ssid, &pr.SSID); |
| 232 | |
| 233 | if (addn_ielen && additional_ie) |
| 234 | p2pie = limGetP2pIEPtr(mac_ctx, additional_ie, addn_ielen); |
| 235 | |
| 236 | /* |
| 237 | * Don't include 11b rate if it is a P2P serach or probe request is |
| 238 | * sent by P2P Client |
| 239 | */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 240 | if ((MLME_DOT11_MODE_11B != dot11mode) && (p2pie) && |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 241 | ((pesession) && (QDF_P2P_CLIENT_MODE == pesession->opmode))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 242 | /* |
| 243 | * In the below API pass channel number > 14, do that it fills |
| 244 | * only 11a rates in supported rates |
| 245 | */ |
| 246 | populate_dot11f_supp_rates(mac_ctx, 15, &pr.SuppRates, |
| 247 | pesession); |
| 248 | } else { |
| 249 | populate_dot11f_supp_rates(mac_ctx, channel, |
| 250 | &pr.SuppRates, pesession); |
| 251 | |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 252 | if (MLME_DOT11_MODE_11B != dot11mode) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 253 | populate_dot11f_ext_supp_rates1(mac_ctx, channel, |
| 254 | &pr.ExtSuppRates); |
| 255 | } |
| 256 | } |
| 257 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 258 | /* |
| 259 | * Table 7-14 in IEEE Std. 802.11k-2008 says |
| 260 | * DS params "can" be present in RRM is disabled and "is" present if |
| 261 | * RRM is enabled. It should be ok even if we add it into probe req when |
| 262 | * RRM is not enabled. |
| 263 | */ |
| 264 | populate_dot11f_ds_params(mac_ctx, &pr.DSParams, channel); |
| 265 | /* Call RRM module to get the tx power for management used. */ |
| 266 | txPower = (uint8_t) rrm_get_mgmt_tx_power(mac_ctx, pesession); |
| 267 | populate_dot11f_wfatpc(mac_ctx, &pr.WFATPC, txPower, 0); |
| 268 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 269 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 270 | if (pesession) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 271 | pesession->htCapability = IS_DOT11_MODE_HT(dot11mode); |
| 272 | /* Include HT Capability IE */ |
| 273 | if (pesession->htCapability) |
| 274 | populate_dot11f_ht_caps(mac_ctx, pesession, &pr.HTCaps); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 275 | } else { /* !pesession */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 276 | if (IS_DOT11_MODE_HT(dot11mode)) |
| 277 | populate_dot11f_ht_caps(mac_ctx, NULL, &pr.HTCaps); |
| 278 | } |
| 279 | |
| 280 | /* |
| 281 | * Set channelbonding information as "disabled" when tunned to a |
| 282 | * 2.4 GHz channel |
| 283 | */ |
| 284 | if (channel <= SIR_11B_CHANNEL_END) { |
| 285 | if (mac_ctx->roam.configParam.channelBondingMode24GHz |
| 286 | == PHY_SINGLE_CHANNEL_CENTERED) { |
| 287 | pr.HTCaps.supportedChannelWidthSet = |
| 288 | eHT_CHANNEL_WIDTH_20MHZ; |
| 289 | pr.HTCaps.shortGI40MHz = 0; |
| 290 | } else { |
| 291 | pr.HTCaps.supportedChannelWidthSet = |
| 292 | eHT_CHANNEL_WIDTH_40MHZ; |
| 293 | } |
| 294 | } |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 295 | if (pesession) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 296 | pesession->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); |
| 297 | /* Include VHT Capability IE */ |
| 298 | if (pesession->vhtCapability) { |
| 299 | populate_dot11f_vht_caps(mac_ctx, pesession, |
| 300 | &pr.VHTCaps); |
| 301 | is_vht_enabled = true; |
| 302 | } |
| 303 | } else { |
| 304 | if (IS_DOT11_MODE_VHT(dot11mode)) { |
| 305 | populate_dot11f_vht_caps(mac_ctx, pesession, |
| 306 | &pr.VHTCaps); |
| 307 | is_vht_enabled = true; |
| 308 | } |
| 309 | } |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 310 | if (pesession) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 311 | populate_dot11f_ext_cap(mac_ctx, is_vht_enabled, &pr.ExtCap, |
| 312 | pesession); |
| 313 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 314 | if (IS_DOT11_MODE_HE(dot11mode) && pesession) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 315 | lim_update_session_he_capable(mac_ctx, pesession); |
| 316 | |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 317 | pe_debug("Populate HE IEs"); |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 318 | populate_dot11f_he_caps(mac_ctx, pesession, &pr.he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 319 | |
Sandeep Puligilla | 493fea2 | 2018-04-30 15:31:17 -0700 | [diff] [blame] | 320 | if (addn_ielen && additional_ie) { |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 321 | qdf_mem_zero((uint8_t *)&extracted_ext_cap, |
| 322 | sizeof(tDot11fIEExtCap)); |
| 323 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 324 | additional_ie, |
| 325 | &addn_ielen, |
| 326 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 327 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 328 | pe_debug("Unable to Stripoff ExtCap IE from Probe Req"); |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 329 | } else { |
| 330 | struct s_ext_cap *p_ext_cap = |
| 331 | (struct s_ext_cap *) |
| 332 | extracted_ext_cap.bytes; |
| 333 | if (p_ext_cap->interworking_service) |
| 334 | p_ext_cap->qos_map = 1; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 335 | extracted_ext_cap.num_bytes = |
| 336 | lim_compute_ext_cap_ie_length |
| 337 | (&extracted_ext_cap); |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 338 | extracted_ext_cap_flag = |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 339 | (extracted_ext_cap.num_bytes > 0); |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 340 | if (additional_ielen) |
| 341 | *additional_ielen = addn_ielen; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 342 | } |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 343 | qcn_ie = wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_QCN_OUI_TYPE, |
| 344 | SIR_MAC_QCN_OUI_TYPE_SIZE, |
| 345 | additional_ie, addn_ielen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 346 | } |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 347 | /* Add qcn_ie only if qcn ie is not present in additional_ie */ |
Wu Gao | 9381621 | 2018-08-31 16:49:54 +0800 | [diff] [blame] | 348 | if (mac_ctx->mlme_cfg->sta.qcn_ie_support && !qcn_ie) |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 349 | populate_dot11f_qcn_ie(&pr.QCN_IE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 350 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 351 | /* |
| 352 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 353 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 354 | * dot11f get packed payload size. |
| 355 | */ |
| 356 | if (extracted_ext_cap_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 357 | lim_merge_extcap_struct(&pr.ExtCap, &extracted_ext_cap, true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 358 | |
| 359 | /* That's it-- now we pack it. First, how much space are we going to */ |
| 360 | status = dot11f_get_packed_probe_request_size(mac_ctx, &pr, &payload); |
| 361 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 362 | 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] | 363 | status); |
| 364 | /* We'll fall back on the worst case scenario: */ |
| 365 | payload = sizeof(tDot11fProbeRequest); |
| 366 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 367 | 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] | 368 | status); |
| 369 | } |
| 370 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 371 | bytes = payload + sizeof(tSirMacMgmtHdr) + addn_ielen; |
| 372 | |
| 373 | /* Ok-- try to allocate some memory: */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 374 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 375 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 376 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 377 | pe_err("Failed to allocate %d bytes for a Probe Request", bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 378 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 379 | } |
| 380 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 381 | qdf_mem_zero(frame, bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 382 | |
| 383 | /* Next, we fill out the buffer descriptor: */ |
| 384 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 385 | SIR_MAC_MGMT_PROBE_REQ, bssid, self_macaddr); |
| 386 | |
| 387 | /* That done, pack the Probe Request: */ |
| 388 | status = dot11f_pack_probe_request(mac_ctx, &pr, frame + |
| 389 | sizeof(tSirMacMgmtHdr), |
| 390 | payload, &payload); |
| 391 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 392 | pe_err("Failed to pack a Probe Request (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 393 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 394 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 395 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 396 | 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] | 397 | } |
| 398 | /* Append any AddIE if present. */ |
| 399 | if (addn_ielen) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 400 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 401 | additional_ie, addn_ielen); |
| 402 | payload += addn_ielen; |
| 403 | } |
| 404 | |
| 405 | /* If this probe request is sent during P2P Search State, then we need |
| 406 | * to send it at OFDM rate. |
| 407 | */ |
Abhishek Singh | 221cf99 | 2018-02-22 13:44:53 +0530 | [diff] [blame] | 408 | if ((BAND_5G == lim_get_rf_band(channel)) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 409 | /* |
| 410 | * For unicast probe req mgmt from Join function we don't set |
| 411 | * above variables. So we need to add one more check whether it |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 412 | * is opmode is P2P_CLIENT or not |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 413 | */ |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 414 | ((pesession) && (QDF_P2P_CLIENT_MODE == pesession->opmode))) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 415 | txflag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 416 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 417 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 418 | wma_tx_frame(mac_ctx, packet, |
| 419 | (uint16_t) sizeof(tSirMacMgmtHdr) + payload, |
| 420 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
| 421 | lim_tx_complete, frame, txflag, sme_sessionid, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 422 | 0, RATEID_DEFAULT); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 423 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 424 | pe_err("could not send Probe Request frame!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 425 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 426 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 427 | } |
| 428 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 429 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 430 | } /* End lim_send_probe_req_mgmt_frame. */ |
| 431 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 432 | 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] | 433 | uint8_t *addIE, uint16_t *addnIELen, |
| 434 | uint8_t probeReqP2pIe) |
| 435 | { |
| 436 | /* If Probe request doesn't have P2P IE, then take out P2P IE |
| 437 | from additional IE */ |
| 438 | if (!probeReqP2pIe) { |
| 439 | uint8_t *tempbuf = NULL; |
| 440 | uint16_t tempLen = 0; |
| 441 | int left = *addnIELen; |
| 442 | uint8_t *ptr = addIE; |
| 443 | uint8_t elem_id, elem_len; |
| 444 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 445 | if (!addIE) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 446 | pe_err("NULL addIE pointer"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 447 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 448 | } |
| 449 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 450 | tempbuf = qdf_mem_malloc(left); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 451 | if (!tempbuf) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 452 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 453 | |
| 454 | while (left >= 2) { |
| 455 | elem_id = ptr[0]; |
| 456 | elem_len = ptr[1]; |
| 457 | left -= 2; |
| 458 | if (elem_len > left) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 459 | pe_err("Invalid IEs eid: %d elem_len: %d left: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 460 | elem_id, elem_len, left); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 461 | qdf_mem_free(tempbuf); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 462 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 463 | } |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 464 | if (!((WLAN_ELEMID_VENDOR == elem_id) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 465 | (memcmp |
| 466 | (&ptr[2], SIR_MAC_P2P_OUI, |
| 467 | SIR_MAC_P2P_OUI_SIZE) == 0))) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 468 | qdf_mem_copy(tempbuf + tempLen, &ptr[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 469 | elem_len + 2); |
| 470 | tempLen += (elem_len + 2); |
| 471 | } |
| 472 | left -= elem_len; |
| 473 | ptr += (elem_len + 2); |
| 474 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 475 | qdf_mem_copy(addIE, tempbuf, tempLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 476 | *addnIELen = tempLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 477 | qdf_mem_free(tempbuf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 478 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 479 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 480 | } |
| 481 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 482 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 483 | lim_send_probe_rsp_mgmt_frame(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 484 | tSirMacAddr peer_macaddr, |
| 485 | tpAniSSID ssid, |
Jeff Johnson | 3c08ace | 2019-03-12 08:50:37 -0700 | [diff] [blame] | 486 | struct pe_session *pe_session, |
| 487 | uint8_t preq_p2pie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 488 | { |
| 489 | tDot11fProbeResponse *frm; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 490 | QDF_STATUS sir_status; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 491 | uint32_t cfg, payload, bytes = 0, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 492 | tpSirMacMgmtHdr mac_hdr; |
| 493 | uint8_t *frame; |
Arif Hussain | fbf5068 | 2016-06-15 12:57:43 -0700 | [diff] [blame] | 494 | void *packet = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 495 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 496 | uint32_t addn_ie_present = false; |
| 497 | |
| 498 | uint16_t addn_ie_len = 0; |
gaurank kathpalia | 837f620 | 2018-09-14 21:55:32 +0530 | [diff] [blame] | 499 | bool wps_ap = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 500 | uint8_t tx_flag = 0; |
| 501 | uint8_t *add_ie = NULL; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 502 | const uint8_t *p2p_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 503 | uint8_t noalen = 0; |
| 504 | uint8_t total_noalen = 0; |
| 505 | uint8_t noa_stream[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
| 506 | uint8_t noa_ie[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
| 507 | uint8_t sme_sessionid = 0; |
| 508 | bool is_vht_enabled = false; |
Padma, Santhosh Kumar | 9223447 | 2017-04-19 18:20:02 +0530 | [diff] [blame] | 509 | tDot11fIEExtCap extracted_ext_cap = {0}; |
Selvaraj, Sridhar | 94ece20 | 2016-06-23 20:44:09 +0530 | [diff] [blame] | 510 | bool extracted_ext_cap_flag = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 511 | |
| 512 | /* We don't answer requests in this case*/ |
Srinivas Girigowda | 35b0031 | 2017-06-27 21:52:03 -0700 | [diff] [blame] | 513 | if (ANI_DRIVER_TYPE(mac_ctx) == QDF_DRIVER_TYPE_MFG) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 514 | return; |
| 515 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 516 | if (!pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 517 | return; |
| 518 | |
| 519 | /* |
| 520 | * In case when cac timer is running for this SAP session then |
| 521 | * avoid sending probe rsp out. It is violation of dfs specification. |
| 522 | */ |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 523 | if (((pe_session->opmode == QDF_SAP_MODE) || |
| 524 | (pe_session->opmode == QDF_P2P_GO_MODE)) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 525 | (true == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 526 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 527 | FL("CAC timer is running, probe response dropped")); |
| 528 | return; |
| 529 | } |
| 530 | sme_sessionid = pe_session->smeSessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 531 | frm = qdf_mem_malloc(sizeof(tDot11fProbeResponse)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 532 | if (!frm) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 533 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 534 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 535 | /* |
| 536 | * Fill out 'frm', after which we'll just hand the struct off to |
| 537 | * 'dot11f_pack_probe_response'. |
| 538 | */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 539 | qdf_mem_zero((uint8_t *) frm, sizeof(tDot11fProbeResponse)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 540 | |
| 541 | /* |
| 542 | * Timestamp to be updated by TFP, below. |
| 543 | * |
| 544 | * Beacon Interval: |
| 545 | */ |
| 546 | if (LIM_IS_AP_ROLE(pe_session)) { |
| 547 | frm->BeaconInterval.interval = |
Jeff Johnson | ac05741 | 2019-01-06 11:08:55 -0800 | [diff] [blame] | 548 | mac_ctx->sch.beacon_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 549 | } else { |
Bala Venkatesh | 2fde2c6 | 2018-09-11 20:33:24 +0530 | [diff] [blame] | 550 | cfg = mac_ctx->mlme_cfg->sap_cfg.beacon_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 551 | frm->BeaconInterval.interval = (uint16_t) cfg; |
| 552 | } |
| 553 | |
| 554 | populate_dot11f_capabilities(mac_ctx, &frm->Capabilities, pe_session); |
| 555 | populate_dot11f_ssid(mac_ctx, (tSirMacSSid *) ssid, &frm->SSID); |
| 556 | populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 557 | &frm->SuppRates, pe_session); |
| 558 | |
| 559 | populate_dot11f_ds_params(mac_ctx, &frm->DSParams, |
| 560 | pe_session->currentOperChannel); |
| 561 | populate_dot11f_ibss_params(mac_ctx, &frm->IBSSParams, pe_session); |
| 562 | |
| 563 | if (LIM_IS_AP_ROLE(pe_session)) { |
| 564 | if (pe_session->wps_state != SAP_WPS_DISABLED) |
| 565 | populate_dot11f_probe_res_wpsi_es(mac_ctx, |
| 566 | &frm->WscProbeRes, |
| 567 | pe_session); |
| 568 | } else { |
gaurank kathpalia | 837f620 | 2018-09-14 21:55:32 +0530 | [diff] [blame] | 569 | wps_ap = mac_ctx->mlme_cfg->wps_params.enable_wps & |
| 570 | WNI_CFG_WPS_ENABLE_AP; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 571 | if (wps_ap) |
| 572 | populate_dot11f_wsc_in_probe_res(mac_ctx, |
| 573 | &frm->WscProbeRes); |
| 574 | |
| 575 | if (mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState == |
| 576 | eLIM_WSC_ENROLL_BEGIN) { |
| 577 | populate_dot11f_wsc_registrar_info_in_probe_res(mac_ctx, |
| 578 | &frm->WscProbeRes); |
| 579 | mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState = |
| 580 | eLIM_WSC_ENROLL_IN_PROGRESS; |
| 581 | } |
| 582 | |
| 583 | if (mac_ctx->lim.wscIeInfo.wscEnrollmentState == |
| 584 | eLIM_WSC_ENROLL_END) { |
| 585 | de_populate_dot11f_wsc_registrar_info_in_probe_res( |
| 586 | mac_ctx, &frm->WscProbeRes); |
| 587 | mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState = |
| 588 | eLIM_WSC_ENROLL_NOOP; |
| 589 | } |
| 590 | } |
| 591 | |
| 592 | populate_dot11f_country(mac_ctx, &frm->Country, pe_session); |
| 593 | populate_dot11f_edca_param_set(mac_ctx, &frm->EDCAParamSet, pe_session); |
| 594 | |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 595 | if (pe_session->dot11mode != MLME_DOT11_MODE_11B) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 596 | populate_dot11f_erp_info(mac_ctx, &frm->ERPInfo, pe_session); |
| 597 | |
| 598 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 599 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 600 | &frm->ExtSuppRates, pe_session); |
| 601 | |
| 602 | /* Populate HT IEs, when operating in 11n */ |
| 603 | if (pe_session->htCapability) { |
| 604 | populate_dot11f_ht_caps(mac_ctx, pe_session, &frm->HTCaps); |
| 605 | populate_dot11f_ht_info(mac_ctx, &frm->HTInfo, pe_session); |
| 606 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 607 | if (pe_session->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 608 | pe_debug("Populate VHT IE in Probe Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 609 | populate_dot11f_vht_caps(mac_ctx, pe_session, &frm->VHTCaps); |
| 610 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
| 611 | &frm->VHTOperation); |
| 612 | /* |
| 613 | * we do not support multi users yet. |
| 614 | * populate_dot11f_vht_ext_bss_load( mac_ctx, |
| 615 | * &frm.VHTExtBssLoad ); |
| 616 | */ |
| 617 | is_vht_enabled = true; |
| 618 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 619 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 620 | if (lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 621 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 622 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 623 | &frm->he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 624 | populate_dot11f_he_operation(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 625 | &frm->he_op); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 626 | } |
| 627 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 628 | populate_dot11f_ext_cap(mac_ctx, is_vht_enabled, &frm->ExtCap, |
| 629 | pe_session); |
| 630 | |
| 631 | if (pe_session->pLimStartBssReq) { |
| 632 | populate_dot11f_wpa(mac_ctx, |
| 633 | &(pe_session->pLimStartBssReq->rsnIE), |
| 634 | &frm->WPA); |
| 635 | populate_dot11f_rsn_opaque(mac_ctx, |
| 636 | &(pe_session->pLimStartBssReq->rsnIE), |
| 637 | &frm->RSNOpaque); |
| 638 | } |
| 639 | |
| 640 | populate_dot11f_wmm(mac_ctx, &frm->WMMInfoAp, &frm->WMMParams, |
| 641 | &frm->WMMCaps, pe_session); |
| 642 | |
| 643 | #if defined(FEATURE_WLAN_WAPI) |
| 644 | if (pe_session->pLimStartBssReq) |
| 645 | populate_dot11f_wapi(mac_ctx, |
| 646 | &(pe_session->pLimStartBssReq->rsnIE), |
| 647 | &frm->WAPI); |
| 648 | #endif /* defined(FEATURE_WLAN_WAPI) */ |
| 649 | |
Liangwei Dong | d7c5e01 | 2018-12-16 23:56:50 -0500 | [diff] [blame] | 650 | /* |
| 651 | * Only use CFG for non-listen mode. This CFG is not working for |
| 652 | * concurrency. In listening mode, probe rsp IEs is passed in |
| 653 | * the message from SME to PE. |
| 654 | */ |
| 655 | addn_ie_present = |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 656 | (pe_session->add_ie_params.probeRespDataLen != 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 657 | |
| 658 | if (addn_ie_present) { |
| 659 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 660 | add_ie = qdf_mem_malloc( |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 661 | pe_session->add_ie_params.probeRespDataLen); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 662 | if (!add_ie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 663 | goto err_ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 664 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 665 | qdf_mem_copy(add_ie, |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 666 | pe_session->add_ie_params.probeRespData_buff, |
| 667 | pe_session->add_ie_params.probeRespDataLen); |
| 668 | addn_ie_len = pe_session->add_ie_params.probeRespDataLen; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 669 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 670 | 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] | 671 | add_ie, &addn_ie_len, preq_p2pie)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 672 | pe_err("Unable to get addn_ie"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 673 | goto err_ret; |
| 674 | } |
| 675 | |
| 676 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 677 | add_ie, &addn_ie_len, |
| 678 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 679 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 680 | pe_debug("Unable to strip off ExtCap IE"); |
Selvaraj, Sridhar | 94ece20 | 2016-06-23 20:44:09 +0530 | [diff] [blame] | 681 | } else { |
| 682 | extracted_ext_cap_flag = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 683 | } |
| 684 | |
| 685 | bytes = bytes + addn_ie_len; |
| 686 | |
| 687 | if (preq_p2pie) |
| 688 | p2p_ie = limGetP2pIEPtr(mac_ctx, &add_ie[0], |
| 689 | addn_ie_len); |
| 690 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 691 | if (p2p_ie) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 692 | /* get NoA attribute stream P2P IE */ |
| 693 | noalen = lim_get_noa_attr_stream(mac_ctx, |
| 694 | noa_stream, pe_session); |
| 695 | if (noalen != 0) { |
| 696 | total_noalen = |
| 697 | lim_build_p2p_ie(mac_ctx, &noa_ie[0], |
| 698 | &noa_stream[0], noalen); |
| 699 | bytes = bytes + total_noalen; |
| 700 | } |
| 701 | } |
| 702 | } |
| 703 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 704 | /* |
| 705 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 706 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 707 | * dot11f get packed payload size. |
| 708 | */ |
| 709 | if (extracted_ext_cap_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 710 | lim_merge_extcap_struct(&frm->ExtCap, &extracted_ext_cap, |
| 711 | true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 712 | |
| 713 | status = dot11f_get_packed_probe_response_size(mac_ctx, frm, &payload); |
| 714 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 715 | pe_err("Probe Response size error (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 716 | status); |
| 717 | /* We'll fall back on the worst case scenario: */ |
| 718 | payload = sizeof(tDot11fProbeResponse); |
| 719 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 720 | pe_warn("Probe Response size warning (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 721 | status); |
| 722 | } |
| 723 | |
| 724 | bytes += payload + sizeof(tSirMacMgmtHdr); |
| 725 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 726 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 727 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 728 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 729 | pe_err("Probe Response allocation failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 730 | goto err_ret; |
| 731 | } |
| 732 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 733 | qdf_mem_zero(frame, bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 734 | |
| 735 | /* Next, we fill out the buffer descriptor: */ |
| 736 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 737 | SIR_MAC_MGMT_PROBE_RSP, peer_macaddr, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 738 | pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 739 | |
| 740 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 741 | |
| 742 | sir_copy_mac_addr(mac_hdr->bssId, pe_session->bssId); |
| 743 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 744 | /* That done, pack the Probe Response: */ |
| 745 | status = |
| 746 | dot11f_pack_probe_response(mac_ctx, frm, |
| 747 | frame + sizeof(tSirMacMgmtHdr), |
| 748 | payload, &payload); |
| 749 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 750 | pe_err("Probe Response pack failure (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 751 | status); |
| 752 | goto err_ret; |
| 753 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 754 | pe_warn("Probe Response pack warning (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 755 | } |
| 756 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 757 | pe_debug("Sending Probe Response frame to"); |
Nishank Aggarwal | 46bd31a | 2017-03-10 16:23:53 +0530 | [diff] [blame] | 758 | lim_print_mac_addr(mac_ctx, peer_macaddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 759 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 760 | if (addn_ie_present) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 761 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 762 | &add_ie[0], addn_ie_len); |
| 763 | |
| 764 | if (noalen != 0) { |
| 765 | if (total_noalen > |
| 766 | (SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 767 | pe_err("Not able to insert NoA, total len=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 768 | total_noalen); |
| 769 | goto err_ret; |
| 770 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 771 | qdf_mem_copy(&frame[bytes - (total_noalen)], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 772 | &noa_ie[0], total_noalen); |
| 773 | } |
| 774 | } |
| 775 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 776 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) || |
| 777 | (pe_session->opmode == QDF_P2P_CLIENT_MODE) || |
| 778 | (pe_session->opmode == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 779 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 780 | |
| 781 | /* Queue Probe Response frame in high priority WQ */ |
Jeff Johnson | 59429b0 | 2018-11-07 13:53:18 -0800 | [diff] [blame] | 782 | qdf_status = wma_tx_frame(mac_ctx, packet, |
| 783 | (uint16_t)bytes, |
| 784 | TXRX_FRM_802_11_MGMT, |
| 785 | ANI_TXDIR_TODS, |
| 786 | 7, lim_tx_complete, frame, tx_flag, |
| 787 | sme_sessionid, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 788 | |
| 789 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 790 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 791 | pe_err("Could not send Probe Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 792 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 793 | if (add_ie) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 794 | qdf_mem_free(add_ie); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 795 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 796 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 797 | return; |
| 798 | |
| 799 | err_ret: |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 800 | if (add_ie) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 801 | qdf_mem_free(add_ie); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 802 | if (frm) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 803 | qdf_mem_free(frm); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 804 | if (packet) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 805 | cds_packet_free((void *)packet); |
| 806 | return; |
| 807 | |
| 808 | } /* End lim_send_probe_rsp_mgmt_frame. */ |
| 809 | |
| 810 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 811 | lim_send_addts_req_action_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 812 | tSirMacAddr peerMacAddr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 813 | tSirAddtsReqInfo *pAddTS, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 814 | { |
| 815 | uint16_t i; |
| 816 | uint8_t *pFrame; |
| 817 | tDot11fAddTSRequest AddTSReq; |
| 818 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 819 | uint32_t nPayload, nBytes, nStatus; |
| 820 | tpSirMacMgmtHdr pMacHdr; |
| 821 | void *pPacket; |
| 822 | #ifdef FEATURE_WLAN_ESE |
| 823 | uint32_t phyMode; |
| 824 | #endif |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 825 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 826 | uint8_t txFlag = 0; |
| 827 | uint8_t smeSessionId = 0; |
| 828 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 829 | if (!pe_session) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 830 | return; |
| 831 | } |
| 832 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 833 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 834 | |
| 835 | if (!pAddTS->wmeTspecPresent) { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 836 | qdf_mem_zero((uint8_t *) &AddTSReq, sizeof(AddTSReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 837 | |
Srinivas Girigowda | 03cebc3 | 2019-05-17 16:50:31 -0700 | [diff] [blame] | 838 | AddTSReq.Action.action = QOS_ADD_TS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 839 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 840 | AddTSReq.Category.category = ACTION_CATEGORY_QOS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 841 | if (pAddTS->lleTspecPresent) { |
| 842 | populate_dot11f_tspec(&pAddTS->tspec, &AddTSReq.TSPEC); |
| 843 | } else { |
| 844 | populate_dot11f_wmmtspec(&pAddTS->tspec, |
| 845 | &AddTSReq.WMMTSPEC); |
| 846 | } |
| 847 | |
| 848 | if (pAddTS->lleTspecPresent) { |
| 849 | AddTSReq.num_WMMTCLAS = 0; |
| 850 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 851 | for (i = 0; i < pAddTS->numTclas; ++i) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 852 | populate_dot11f_tclas(mac, &pAddTS->tclasInfo[i], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 853 | &AddTSReq.TCLAS[i]); |
| 854 | } |
| 855 | } else { |
| 856 | AddTSReq.num_TCLAS = 0; |
| 857 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 858 | for (i = 0; i < pAddTS->numTclas; ++i) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 859 | populate_dot11f_wmmtclas(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 860 | &pAddTS->tclasInfo[i], |
| 861 | &AddTSReq.WMMTCLAS[i]); |
| 862 | } |
| 863 | } |
| 864 | |
| 865 | if (pAddTS->tclasProcPresent) { |
| 866 | if (pAddTS->lleTspecPresent) { |
| 867 | AddTSReq.TCLASSPROC.processing = |
| 868 | pAddTS->tclasProc; |
| 869 | AddTSReq.TCLASSPROC.present = 1; |
| 870 | } else { |
| 871 | AddTSReq.WMMTCLASPROC.version = 1; |
| 872 | AddTSReq.WMMTCLASPROC.processing = |
| 873 | pAddTS->tclasProc; |
| 874 | AddTSReq.WMMTCLASPROC.present = 1; |
| 875 | } |
| 876 | } |
| 877 | |
| 878 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 879 | dot11f_get_packed_add_ts_request_size(mac, &AddTSReq, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 880 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 881 | pe_err("Failed to calculate the packed size for an Add TS Request (0x%08x)", |
| 882 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 883 | /* We'll fall back on the worst case scenario: */ |
| 884 | nPayload = sizeof(tDot11fAddTSRequest); |
| 885 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 886 | pe_warn("There were warnings while calculating the packed size for an Add TS Request (0x%08x)", |
| 887 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 888 | } |
| 889 | } else { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 890 | qdf_mem_zero((uint8_t *) &WMMAddTSReq, sizeof(WMMAddTSReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 891 | |
Srinivas Girigowda | 03cebc3 | 2019-05-17 16:50:31 -0700 | [diff] [blame] | 892 | WMMAddTSReq.Action.action = QOS_ADD_TS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 893 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 894 | WMMAddTSReq.Category.category = ACTION_CATEGORY_WMM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 895 | |
| 896 | /* WMM spec 2.2.10 - status code is only filled in for ADDTS response */ |
| 897 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 898 | |
| 899 | populate_dot11f_wmmtspec(&pAddTS->tspec, &WMMAddTSReq.WMMTSPEC); |
| 900 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 901 | lim_get_phy_mode(mac, &phyMode, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 902 | |
| 903 | if (phyMode == WNI_CFG_PHY_MODE_11G |
| 904 | || phyMode == WNI_CFG_PHY_MODE_11A) { |
| 905 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 906 | } else { |
| 907 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 908 | } |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 909 | populate_dot11_tsrsie(mac, &pAddTS->tsrsIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 910 | &WMMAddTSReq.ESETrafStrmRateSet, |
| 911 | sizeof(uint8_t)); |
| 912 | #endif |
| 913 | /* fillWmeTspecIE */ |
| 914 | |
| 915 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 916 | dot11f_get_packed_wmm_add_ts_request_size(mac, &WMMAddTSReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 917 | &nPayload); |
| 918 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 919 | 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] | 920 | nStatus); |
| 921 | /* We'll fall back on the worst case scenario: */ |
| 922 | nPayload = sizeof(tDot11fAddTSRequest); |
| 923 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 924 | pe_warn("There were warnings while calculating the packed size for a WMM Add TS Request (0x%08x)", |
| 925 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 926 | } |
| 927 | } |
| 928 | |
| 929 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 930 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 931 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 932 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 933 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 934 | pe_err("Failed to allocate %d bytes for an Add TS Request", |
| 935 | nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 936 | return; |
| 937 | } |
| 938 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 939 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 940 | |
| 941 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 942 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 943 | SIR_MAC_MGMT_ACTION, peerMacAddr, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 944 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 945 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 946 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 947 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 948 | lim_set_protected_bit(mac, pe_session, peerMacAddr, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 949 | |
| 950 | /* That done, pack the struct: */ |
| 951 | if (!pAddTS->wmeTspecPresent) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 952 | nStatus = dot11f_pack_add_ts_request(mac, &AddTSReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 953 | pFrame + |
| 954 | sizeof(tSirMacMgmtHdr), |
| 955 | nPayload, &nPayload); |
| 956 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 957 | pe_err("Failed to pack an Add TS Request " |
| 958 | "(0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 959 | cds_packet_free((void *)pPacket); |
| 960 | return; /* allocated! */ |
| 961 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 962 | pe_warn("There were warnings while packing an Add TS Request (0x%08x)", |
| 963 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 964 | } |
| 965 | } else { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 966 | nStatus = dot11f_pack_wmm_add_ts_request(mac, &WMMAddTSReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 967 | pFrame + |
| 968 | sizeof(tSirMacMgmtHdr), |
| 969 | nPayload, &nPayload); |
| 970 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 971 | pe_err("Failed to pack a WMM Add TS Request (0x%08x)", |
| 972 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 973 | cds_packet_free((void *)pPacket); |
| 974 | return; /* allocated! */ |
| 975 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 976 | pe_warn("There were warnings while packing a WMM Add TS Request (0x%08x)", |
| 977 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 978 | } |
| 979 | } |
| 980 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 981 | pe_debug("Sending an Add TS Request frame to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 982 | lim_print_mac_addr(mac, peerMacAddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 983 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 984 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) || |
| 985 | (pe_session->opmode == QDF_P2P_CLIENT_MODE) || |
| 986 | (pe_session->opmode == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 987 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 988 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 989 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 990 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 991 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 992 | pe_session, QDF_STATUS_SUCCESS, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 993 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 994 | |
| 995 | /* Queue Addts Response frame in high priority WQ */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 996 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 997 | TXRX_FRM_802_11_MGMT, |
| 998 | ANI_TXDIR_TODS, |
| 999 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1000 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1001 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1002 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1003 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1004 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 1005 | pe_err("Could not send an Add TS Request (%X", |
| 1006 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1007 | } /* End lim_send_addts_req_action_frame. */ |
| 1008 | |
| 1009 | /** |
| 1010 | * lim_send_assoc_rsp_mgmt_frame() - Send assoc response |
| 1011 | * @mac_ctx: Handle for mac context |
| 1012 | * @status_code: Status code for assoc response frame |
| 1013 | * @aid: Association ID |
| 1014 | * @peer_addr: Mac address of requesting peer |
| 1015 | * @subtype: Assoc/Reassoc |
| 1016 | * @sta: Pointer to station node |
| 1017 | * @pe_session: PE session id. |
| 1018 | * |
| 1019 | * Builds and sends association response frame to the requesting peer. |
| 1020 | * |
| 1021 | * Return: void |
| 1022 | */ |
| 1023 | |
| 1024 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1025 | lim_send_assoc_rsp_mgmt_frame(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1026 | uint16_t status_code, uint16_t aid, tSirMacAddr peer_addr, |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 1027 | uint8_t subtype, tpDphHashNode sta, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1028 | { |
| 1029 | static tDot11fAssocResponse frm; |
| 1030 | uint8_t *frame; |
| 1031 | tpSirMacMgmtHdr mac_hdr; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1032 | QDF_STATUS sir_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1033 | uint8_t lle_mode = 0, addts; |
| 1034 | tHalBitVal qos_mode, wme_mode; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1035 | uint32_t payload, bytes = 0, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1036 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1037 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1038 | tUpdateBeaconParams beacon_params; |
| 1039 | uint8_t tx_flag = 0; |
| 1040 | uint32_t addn_ie_len = 0; |
| 1041 | uint8_t add_ie[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1042 | tpSirAssocReq assoc_req = NULL; |
| 1043 | uint8_t sme_session = 0; |
| 1044 | bool is_vht = false; |
| 1045 | uint16_t stripoff_len = 0; |
| 1046 | tDot11fIEExtCap extracted_ext_cap; |
| 1047 | bool extracted_flag = false; |
| 1048 | #ifdef WLAN_FEATURE_11W |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 1049 | uint8_t retry_int; |
| 1050 | uint16_t max_retries; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1051 | #endif |
| 1052 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1053 | if (!pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1054 | pe_err("pe_session is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1055 | return; |
| 1056 | } |
| 1057 | |
| 1058 | sme_session = pe_session->smeSessionId; |
| 1059 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1060 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1061 | |
| 1062 | limGetQosMode(pe_session, &qos_mode); |
| 1063 | limGetWmeMode(pe_session, &wme_mode); |
| 1064 | |
| 1065 | /* |
| 1066 | * An Add TS IE is added only if the AP supports it and |
| 1067 | * the requesting STA sent a traffic spec. |
| 1068 | */ |
| 1069 | addts = (qos_mode && sta && sta->qos.addtsPresent) ? 1 : 0; |
| 1070 | |
| 1071 | frm.Status.status = status_code; |
| 1072 | |
| 1073 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1074 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1075 | if (!sta) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1076 | populate_dot11f_supp_rates(mac_ctx, |
| 1077 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1078 | &frm.SuppRates, pe_session); |
| 1079 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 1080 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1081 | &frm.ExtSuppRates, pe_session); |
| 1082 | } else { |
| 1083 | populate_dot11f_assoc_rsp_rates(mac_ctx, &frm.SuppRates, |
| 1084 | &frm.ExtSuppRates, |
| 1085 | sta->supportedRates.llbRates, |
| 1086 | sta->supportedRates.llaRates); |
| 1087 | } |
| 1088 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1089 | if (LIM_IS_AP_ROLE(pe_session) && sta && |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1090 | QDF_STATUS_SUCCESS == status_code) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1091 | assoc_req = (tpSirAssocReq) |
| 1092 | pe_session->parsedAssocReq[sta->assocId]; |
| 1093 | /* |
| 1094 | * populate P2P IE in AssocRsp when assocReq from the peer |
| 1095 | * includes P2P IE |
| 1096 | */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1097 | if (assoc_req && assoc_req->addIEPresent) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1098 | populate_dot11_assoc_res_p2p_ie(mac_ctx, |
| 1099 | &frm.P2PAssocRes, |
| 1100 | assoc_req); |
| 1101 | } |
| 1102 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1103 | if (sta) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1104 | if (eHAL_SET == qos_mode) { |
| 1105 | if (sta->lleEnabled) { |
| 1106 | lle_mode = 1; |
| 1107 | populate_dot11f_edca_param_set(mac_ctx, |
| 1108 | &frm.EDCAParamSet, pe_session); |
| 1109 | } |
| 1110 | } |
| 1111 | |
| 1112 | if ((!lle_mode) && (eHAL_SET == wme_mode) && sta->wmeEnabled) { |
| 1113 | populate_dot11f_wmm_params(mac_ctx, &frm.WMMParams, |
| 1114 | pe_session); |
| 1115 | |
| 1116 | if (sta->wsmEnabled) |
| 1117 | populate_dot11f_wmm_caps(&frm.WMMCaps); |
| 1118 | } |
| 1119 | |
| 1120 | if (sta->mlmStaContext.htCapability && |
| 1121 | pe_session->htCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1122 | pe_debug("Populate HT IEs in Assoc Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1123 | populate_dot11f_ht_caps(mac_ctx, pe_session, |
| 1124 | &frm.HTCaps); |
Krunal Soni | ef3294b | 2015-06-12 15:12:19 -0700 | [diff] [blame] | 1125 | /* |
| 1126 | * Check the STA capability and |
| 1127 | * update the HTCaps accordingly |
| 1128 | */ |
| 1129 | frm.HTCaps.supportedChannelWidthSet = ( |
| 1130 | sta->htSupportedChannelWidthSet < |
| 1131 | pe_session->htSupportedChannelWidthSet) ? |
| 1132 | sta->htSupportedChannelWidthSet : |
| 1133 | pe_session->htSupportedChannelWidthSet; |
| 1134 | if (!frm.HTCaps.supportedChannelWidthSet) |
| 1135 | frm.HTCaps.shortGI40MHz = 0; |
| 1136 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1137 | populate_dot11f_ht_info(mac_ctx, &frm.HTInfo, |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 1138 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1139 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1140 | 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] | 1141 | frm.HTCaps.supportedChannelWidthSet, |
| 1142 | frm.HTCaps.mimoPowerSave, |
| 1143 | frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, |
| 1144 | frm.HTCaps.shortGI40MHz, |
| 1145 | frm.HTCaps.dsssCckMode40MHz, |
| 1146 | frm.HTCaps.maxRxAMPDUFactor); |
| 1147 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1148 | if (sta->mlmStaContext.vhtCapability && |
| 1149 | pe_session->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1150 | pe_debug("Populate VHT IEs in Assoc Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1151 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
| 1152 | &frm.VHTCaps); |
| 1153 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1154 | &frm.VHTOperation); |
| 1155 | is_vht = true; |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 1156 | } else if (sta->mlmStaContext.force_1x1 && |
| 1157 | frm.HTCaps.present) { |
| 1158 | /* |
| 1159 | * WAR: In P2P GO mode, if the P2P client device |
| 1160 | * is only HT capable and not VHT capable, but the P2P |
| 1161 | * GO device is VHT capable and advertises 2x2 NSS with |
| 1162 | * HT capablity client device, which results in IOT |
| 1163 | * issues. |
| 1164 | * When GO is operating in DBS mode, GO beacons |
| 1165 | * advertise 2x2 capability but include OMN IE to |
| 1166 | * indicate current operating mode of 1x1. But here |
| 1167 | * peer device is only HT capable and will not |
| 1168 | * understand OMN IE. |
| 1169 | */ |
| 1170 | frm.HTInfo.basicMCSSet[1] = 0; |
| 1171 | frm.HTCaps.supportedMCSSet[1] = 0; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1172 | } |
Naveen Rawat | 903acca | 2017-09-15 17:32:13 -0700 | [diff] [blame] | 1173 | |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1174 | if (pe_session->vhtCapability && |
| 1175 | pe_session->vendor_vht_sap && |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1176 | (assoc_req) && |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1177 | assoc_req->vendor_vht_ie.VHTCaps.present) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1178 | pe_debug("Populate Vendor VHT IEs in Assoc Rsponse"); |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1179 | frm.vendor_vht_ie.present = 1; |
Kiran Kumar Lokere | 8172263 | 2017-09-26 12:11:43 -0700 | [diff] [blame] | 1180 | frm.vendor_vht_ie.sub_type = |
| 1181 | pe_session->vendor_specific_vht_ie_sub_type; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1182 | frm.vendor_vht_ie.VHTCaps.present = 1; |
| 1183 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
| 1184 | &frm.vendor_vht_ie.VHTCaps); |
Kiran Kumar Lokere | cc44868 | 2017-07-20 18:08:01 -0700 | [diff] [blame] | 1185 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
| 1186 | &frm.vendor_vht_ie.VHTOperation); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1187 | is_vht = true; |
| 1188 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1189 | populate_dot11f_ext_cap(mac_ctx, is_vht, &frm.ExtCap, |
| 1190 | pe_session); |
| 1191 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1192 | if (lim_is_sta_he_capable(sta) && |
| 1193 | lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1194 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1195 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1196 | &frm.he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1197 | populate_dot11f_he_operation(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1198 | &frm.he_op); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1199 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1200 | #ifdef WLAN_FEATURE_11W |
| 1201 | if (eSIR_MAC_TRY_AGAIN_LATER == status_code) { |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 1202 | max_retries = |
| 1203 | mac_ctx->mlme_cfg->gen.pmf_sa_query_max_retries; |
| 1204 | retry_int = |
| 1205 | mac_ctx->mlme_cfg->gen.pmf_sa_query_retry_interval; |
| 1206 | populate_dot11f_timeout_interval(mac_ctx, |
| 1207 | &frm.TimeoutInterval, |
| 1208 | SIR_MAC_TI_TYPE_ASSOC_COMEBACK, |
| 1209 | (max_retries - |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1210 | sta->pmfSaQueryRetryCount) |
| 1211 | * retry_int); |
| 1212 | } |
| 1213 | #endif |
Arif Hussain | 0c81692 | 2017-04-06 15:04:44 -0700 | [diff] [blame] | 1214 | |
| 1215 | if (LIM_IS_AP_ROLE(pe_session) && sta->non_ecsa_capable) |
| 1216 | pe_session->lim_non_ecsa_cap_num++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1217 | } |
| 1218 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1219 | qdf_mem_zero((uint8_t *) &beacon_params, sizeof(beacon_params)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1220 | |
| 1221 | if (LIM_IS_AP_ROLE(pe_session) && |
Pragaspathi Thilagaraj | 1ee7600 | 2018-09-18 21:38:51 +0530 | [diff] [blame] | 1222 | (pe_session->gLimProtectionControl != |
| 1223 | MLME_FORCE_POLICY_PROTECTION_DISABLE)) |
| 1224 | lim_decide_ap_protection(mac_ctx, peer_addr, &beacon_params, |
| 1225 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1226 | |
| 1227 | lim_update_short_preamble(mac_ctx, peer_addr, &beacon_params, |
| 1228 | pe_session); |
| 1229 | lim_update_short_slot_time(mac_ctx, peer_addr, &beacon_params, |
| 1230 | pe_session); |
| 1231 | |
| 1232 | /* |
| 1233 | * Populate Do11capabilities after updating session with |
| 1234 | * Assos req details |
| 1235 | */ |
| 1236 | populate_dot11f_capabilities(mac_ctx, &frm.Capabilities, pe_session); |
| 1237 | |
Pragaspathi Thilagaraj | e05162d | 2019-05-23 13:10:46 +0530 | [diff] [blame] | 1238 | beacon_params.bss_idx = pe_session->bss_idx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1239 | |
| 1240 | /* Send message to HAL about beacon parameter change. */ |
| 1241 | if ((false == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running) |
| 1242 | && beacon_params.paramChangeBitmap) { |
| 1243 | sch_set_fixed_beacon_fields(mac_ctx, pe_session); |
| 1244 | lim_send_beacon_params(mac_ctx, &beacon_params, pe_session); |
| 1245 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1246 | |
Arif Hussain | 1513cb2 | 2018-01-05 19:56:31 -0800 | [diff] [blame] | 1247 | lim_obss_send_detection_cfg(mac_ctx, pe_session, false); |
| 1248 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1249 | if (assoc_req) { |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 1250 | addn_ie_len = pe_session->add_ie_params.assocRespDataLen; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1251 | |
| 1252 | /* Nonzero length indicates Assoc rsp IE available */ |
Krishna Kumaar Natarajan | e4e3a14 | 2016-04-01 16:27:51 -0700 | [diff] [blame] | 1253 | if (addn_ie_len > 0 && |
| 1254 | addn_ie_len <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && |
| 1255 | (bytes + addn_ie_len) <= SIR_MAX_PACKET_SIZE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1256 | qdf_mem_copy(add_ie, |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 1257 | pe_session->add_ie_params.assocRespData_buff, |
| 1258 | pe_session->add_ie_params.assocRespDataLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1259 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1260 | qdf_mem_zero((uint8_t *) &extracted_ext_cap, |
| 1261 | sizeof(extracted_ext_cap)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1262 | |
| 1263 | stripoff_len = addn_ie_len; |
| 1264 | sir_status = |
| 1265 | lim_strip_extcap_update_struct |
| 1266 | (mac_ctx, &add_ie[0], &stripoff_len, |
| 1267 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1268 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1269 | pe_debug("strip off extcap IE failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1270 | } else { |
| 1271 | addn_ie_len = stripoff_len; |
| 1272 | extracted_flag = true; |
| 1273 | } |
| 1274 | bytes = bytes + addn_ie_len; |
| 1275 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1276 | pe_debug("addn_ie_len: %d for Assoc Resp: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1277 | addn_ie_len, assoc_req->addIEPresent); |
| 1278 | } |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1279 | |
| 1280 | /* |
| 1281 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 1282 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 1283 | * dot11f get packed payload size. |
| 1284 | */ |
| 1285 | if (extracted_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1286 | lim_merge_extcap_struct(&(frm.ExtCap), &extracted_ext_cap, |
| 1287 | true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1288 | |
| 1289 | /* Allocate a buffer for this frame: */ |
| 1290 | status = dot11f_get_packed_assoc_response_size(mac_ctx, &frm, &payload); |
| 1291 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1292 | pe_err("get Association Response size failure (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1293 | status); |
| 1294 | return; |
| 1295 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1296 | pe_warn("get Association Response size warning (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1297 | status); |
| 1298 | } |
| 1299 | |
| 1300 | bytes += sizeof(tSirMacMgmtHdr) + payload; |
| 1301 | |
Min Liu | 0daa098 | 2019-02-01 17:50:44 +0800 | [diff] [blame] | 1302 | if (sta) |
| 1303 | bytes += sta->mlmStaContext.owe_ie_len; |
| 1304 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1305 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1306 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1307 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1308 | pe_err("cds_packet_alloc failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1309 | return; |
| 1310 | } |
| 1311 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1312 | qdf_mem_zero(frame, bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1313 | |
| 1314 | /* Next, we fill out the buffer descriptor: */ |
| 1315 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 1316 | (LIM_ASSOC == subtype) ? |
| 1317 | SIR_MAC_MGMT_ASSOC_RSP : SIR_MAC_MGMT_REASSOC_RSP, |
| 1318 | peer_addr, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 1319 | pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1320 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 1321 | |
| 1322 | sir_copy_mac_addr(mac_hdr->bssId, pe_session->bssId); |
| 1323 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1324 | status = dot11f_pack_assoc_response(mac_ctx, &frm, |
| 1325 | frame + sizeof(tSirMacMgmtHdr), |
| 1326 | payload, &payload); |
| 1327 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1328 | pe_err("Association Response pack failure(0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1329 | status); |
| 1330 | cds_packet_free((void *)packet); |
| 1331 | return; |
| 1332 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1333 | pe_warn("Association Response pack warning (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1334 | status); |
| 1335 | } |
| 1336 | |
| 1337 | if (subtype == LIM_ASSOC) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1338 | pe_debug("*** Sending Assoc Resp status %d aid %d to", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1339 | status_code, aid); |
| 1340 | else |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1341 | pe_debug("*** Sending ReAssoc Resp status %d aid %d to", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1342 | status_code, aid); |
| 1343 | |
Abhishek Singh | 5d8d733 | 2017-08-10 15:15:24 +0530 | [diff] [blame] | 1344 | lim_print_mac_addr(mac_ctx, mac_hdr->da, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1345 | |
| 1346 | 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] | 1347 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1348 | &add_ie[0], addn_ie_len); |
| 1349 | |
Min Liu | 0daa098 | 2019-02-01 17:50:44 +0800 | [diff] [blame] | 1350 | if (sta && sta->mlmStaContext.owe_ie_len) |
| 1351 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload |
| 1352 | + addn_ie_len, |
| 1353 | sta->mlmStaContext.owe_ie, |
| 1354 | sta->mlmStaContext.owe_ie_len); |
| 1355 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1356 | if ((BAND_5G == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1357 | lim_get_rf_band(pe_session->currentOperChannel)) || |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 1358 | (pe_session->opmode == QDF_P2P_CLIENT_MODE) || |
| 1359 | (pe_session->opmode == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1360 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1361 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1362 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1363 | pe_session->peSessionId, mac_hdr->fc.subType)); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 1364 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1365 | pe_session, QDF_STATUS_SUCCESS, status_code); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1366 | /* Queue Association Response frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1367 | qdf_status = wma_tx_frame(mac_ctx, packet, (uint16_t) bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1368 | TXRX_FRM_802_11_MGMT, |
| 1369 | ANI_TXDIR_TODS, |
| 1370 | 7, lim_tx_complete, frame, tx_flag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1371 | sme_session, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1372 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1373 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1374 | |
| 1375 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1376 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1377 | pe_err("Could not Send Re/AssocRsp, retCode=%X", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1378 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1379 | |
| 1380 | /* |
| 1381 | * update the ANI peer station count. |
| 1382 | * FIXME_PROTECTION : take care of different type of station |
| 1383 | * counter inside this function. |
| 1384 | */ |
| 1385 | lim_util_count_sta_add(mac_ctx, sta, pe_session); |
| 1386 | |
| 1387 | } |
| 1388 | |
| 1389 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1390 | lim_send_delts_req_action_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1391 | tSirMacAddr peer, |
| 1392 | uint8_t wmmTspecPresent, |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1393 | struct mac_ts_info *pTsinfo, |
Jeff Johnson | 56471b9 | 2018-12-22 14:36:06 -0800 | [diff] [blame] | 1394 | struct mac_tspec_ie *pTspecIe, |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1395 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1396 | { |
| 1397 | uint8_t *pFrame; |
| 1398 | tpSirMacMgmtHdr pMacHdr; |
| 1399 | tDot11fDelTS DelTS; |
| 1400 | tDot11fWMMDelTS WMMDelTS; |
| 1401 | uint32_t nBytes, nPayload, nStatus; |
| 1402 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1403 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1404 | uint8_t txFlag = 0; |
| 1405 | uint8_t smeSessionId = 0; |
| 1406 | |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1407 | if (!pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1408 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1409 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1410 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1411 | |
| 1412 | if (!wmmTspecPresent) { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1413 | qdf_mem_zero((uint8_t *) &DelTS, sizeof(DelTS)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1414 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 1415 | DelTS.Category.category = ACTION_CATEGORY_QOS; |
Srinivas Girigowda | 03cebc3 | 2019-05-17 16:50:31 -0700 | [diff] [blame] | 1416 | DelTS.Action.action = QOS_DEL_TS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1417 | populate_dot11f_ts_info(pTsinfo, &DelTS.TSInfo); |
| 1418 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1419 | nStatus = dot11f_get_packed_del_ts_size(mac, &DelTS, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1420 | if (DOT11F_FAILED(nStatus)) { |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1421 | pe_err("Failed to calculate the packed size for a Del TS (0x%08x)", |
| 1422 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1423 | /* We'll fall back on the worst case scenario: */ |
| 1424 | nPayload = sizeof(tDot11fDelTS); |
| 1425 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1426 | pe_warn("There were warnings while calculating the packed size for a Del TS (0x%08x)", |
| 1427 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1428 | } |
| 1429 | } else { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1430 | qdf_mem_zero((uint8_t *) &WMMDelTS, sizeof(WMMDelTS)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1431 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 1432 | WMMDelTS.Category.category = ACTION_CATEGORY_WMM; |
Srinivas Girigowda | 03cebc3 | 2019-05-17 16:50:31 -0700 | [diff] [blame] | 1433 | WMMDelTS.Action.action = QOS_DEL_TS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1434 | WMMDelTS.DialogToken.token = 0; |
| 1435 | WMMDelTS.StatusCode.statusCode = 0; |
| 1436 | populate_dot11f_wmmtspec(pTspecIe, &WMMDelTS.WMMTSPEC); |
| 1437 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1438 | dot11f_get_packed_wmm_del_ts_size(mac, &WMMDelTS, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1439 | if (DOT11F_FAILED(nStatus)) { |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1440 | pe_err("Failed to calculate the packed size for a WMM Del TS (0x%08x)", |
| 1441 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1442 | /* We'll fall back on the worst case scenario: */ |
| 1443 | nPayload = sizeof(tDot11fDelTS); |
| 1444 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1445 | pe_warn("There were warnings while calculating the packed size for a WMM Del TS (0x%08x)", |
| 1446 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1447 | } |
| 1448 | } |
| 1449 | |
| 1450 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 1451 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1452 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1453 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 1454 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1455 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1456 | pe_err("Failed to allocate %d bytes for an Add TS Response", |
| 1457 | nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1458 | return; |
| 1459 | } |
| 1460 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1461 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1462 | |
| 1463 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1464 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 1465 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1466 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 1467 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1468 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1469 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1470 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1471 | |
| 1472 | /* That done, pack the struct: */ |
| 1473 | if (!wmmTspecPresent) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1474 | nStatus = dot11f_pack_del_ts(mac, &DelTS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1475 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1476 | nPayload, &nPayload); |
| 1477 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1478 | pe_err("Failed to pack a Del TS frame (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1479 | nStatus); |
| 1480 | cds_packet_free((void *)pPacket); |
| 1481 | return; /* allocated! */ |
| 1482 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1483 | pe_warn("There were warnings while packing a Del TS frame (0x%08x)", |
| 1484 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1485 | } |
| 1486 | } else { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1487 | nStatus = dot11f_pack_wmm_del_ts(mac, &WMMDelTS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1488 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1489 | nPayload, &nPayload); |
| 1490 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1491 | pe_err("Failed to pack a WMM Del TS frame (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1492 | nStatus); |
| 1493 | cds_packet_free((void *)pPacket); |
| 1494 | return; /* allocated! */ |
| 1495 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1496 | pe_warn("There were warnings while packing a WMM Del TS frame (0x%08x)", |
| 1497 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1498 | } |
| 1499 | } |
| 1500 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1501 | pe_debug("Sending DELTS REQ (size %d) to ", nBytes); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1502 | lim_print_mac_addr(mac, pMacHdr->da, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1503 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 1504 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) || |
| 1505 | (pe_session->opmode == QDF_P2P_CLIENT_MODE) || |
| 1506 | (pe_session->opmode == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1507 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1508 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1509 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1510 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1511 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1512 | pe_session, QDF_STATUS_SUCCESS, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1513 | QDF_STATUS_SUCCESS); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1514 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1515 | TXRX_FRM_802_11_MGMT, |
| 1516 | ANI_TXDIR_TODS, |
| 1517 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1518 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1519 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1520 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1521 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1522 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1523 | pe_err("Failed to send Del TS (%X)!", qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1524 | |
| 1525 | } /* End lim_send_delts_req_action_frame. */ |
| 1526 | |
| 1527 | /** |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1528 | * lim_assoc_tx_complete_cnf()- Confirmation for assoc sent over the air |
| 1529 | * @context: pointer to global mac |
| 1530 | * @buf: buffer |
| 1531 | * @tx_complete : Sent status |
| 1532 | * @params; tx completion params |
| 1533 | * |
| 1534 | * Return: This returns QDF_STATUS |
| 1535 | */ |
| 1536 | |
| 1537 | static QDF_STATUS lim_assoc_tx_complete_cnf(void *context, |
| 1538 | qdf_nbuf_t buf, |
| 1539 | uint32_t tx_complete, |
| 1540 | void *params) |
| 1541 | { |
| 1542 | uint16_t assoc_ack_status; |
| 1543 | uint16_t reason_code; |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1544 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1545 | |
| 1546 | pe_debug("tx_complete= %d", tx_complete); |
Zhu Jianmin | 5d8e3fe | 2018-01-04 16:16:20 +0800 | [diff] [blame] | 1547 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) { |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1548 | assoc_ack_status = ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1549 | reason_code = QDF_STATUS_SUCCESS; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1550 | } else { |
| 1551 | assoc_ack_status = NOT_ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1552 | reason_code = QDF_STATUS_E_FAILURE; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1553 | } |
| 1554 | if (buf) |
| 1555 | qdf_nbuf_free(buf); |
| 1556 | |
| 1557 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_ACK_EVENT, |
| 1558 | NULL, assoc_ack_status, reason_code); |
| 1559 | return QDF_STATUS_SUCCESS; |
| 1560 | } |
| 1561 | |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 1562 | #ifdef WLAN_ADAPTIVE_11R |
| 1563 | /** |
| 1564 | * lim_fill_adaptive_11r_ie() - Populate the Vendor secific adaptive 11r |
| 1565 | * IE to association request frame |
| 1566 | * @pe_session: pointer to PE session |
| 1567 | * @ie_buf: buffer to which Adaptive 11r IE will be copied |
| 1568 | * @ie_len: length of the Adaptive 11r Vendor specific IE |
| 1569 | * |
| 1570 | * Return QDF_STATUS |
| 1571 | */ |
| 1572 | static QDF_STATUS lim_fill_adaptive_11r_ie(struct pe_session *pe_session, |
| 1573 | uint8_t **ie_buf, uint8_t *ie_len) |
| 1574 | { |
| 1575 | uint8_t *buf = NULL, *adaptive_11r_ie = NULL; |
| 1576 | |
| 1577 | if (!pe_session->is_adaptive_11r_connection) |
| 1578 | return QDF_STATUS_SUCCESS; |
| 1579 | |
| 1580 | /* |
| 1581 | * Vendor specific Adaptive 11r IE to be advertised in Assoc |
| 1582 | * req: |
| 1583 | * Type 0xDD |
| 1584 | * Length 0x0B |
| 1585 | * OUI 0x00 0x00 0x0F |
| 1586 | * Type 0x22 |
| 1587 | * subtype 0x00 |
| 1588 | * Version 0x01 |
| 1589 | * Length 0x04 |
| 1590 | * Data 0x00 00 00 01(0th bit is 1 means adaptive 11r is |
| 1591 | * supported) |
| 1592 | */ |
| 1593 | adaptive_11r_ie = qdf_mem_malloc(ADAPTIVE_11R_STA_IE_LEN + 2); |
| 1594 | if (!adaptive_11r_ie) |
| 1595 | return QDF_STATUS_E_FAILURE; |
| 1596 | |
| 1597 | /* Fill the Vendor IE Type (0xDD) */ |
| 1598 | buf = adaptive_11r_ie; |
Srinivas Girigowda | 8e7ecab | 2019-05-16 11:31:19 -0700 | [diff] [blame] | 1599 | *buf = WLAN_ELEMID_VENDOR; |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 1600 | buf++; |
| 1601 | |
| 1602 | /* Fill the Vendor IE length (0x0B) */ |
| 1603 | *buf = ADAPTIVE_11R_STA_IE_LEN; |
| 1604 | buf++; |
| 1605 | |
| 1606 | /* |
| 1607 | * Fill the Adaptive 11r Vendor specific OUI(0x00 0x00 0x0F 0x22) |
| 1608 | */ |
| 1609 | qdf_mem_copy(buf, ADAPTIVE_11R_STA_OUI, ADAPTIVE_11R_OUI_LEN); |
| 1610 | buf += ADAPTIVE_11R_OUI_LEN; |
| 1611 | |
| 1612 | /* Fill Adaptive 11r Vendor specific Subtype (0x00) */ |
| 1613 | *buf = ADAPTIVE_11R_OUI_SUBTYPE; |
| 1614 | buf++; |
| 1615 | |
| 1616 | /* Fill Adaptive 11r Version (0x01) */ |
| 1617 | *buf = ADAPTIVE_11R_OUI_VERSION; |
| 1618 | buf++; |
| 1619 | |
| 1620 | /* Fill Adaptive 11r IE Data length (0x04) */ |
| 1621 | *buf = ADAPTIVE_11R_DATA_LEN; |
| 1622 | buf++; |
| 1623 | |
| 1624 | /* Fill Adaptive 11r IE Data (0x00 0x00 0x00 0x01) */ |
| 1625 | qdf_mem_copy(buf, ADAPTIVE_11R_OUI_DATA, ADAPTIVE_11R_DATA_LEN); |
| 1626 | |
| 1627 | *ie_len = ADAPTIVE_11R_STA_IE_LEN + 2; |
| 1628 | *ie_buf = adaptive_11r_ie; |
| 1629 | |
| 1630 | return QDF_STATUS_SUCCESS; |
| 1631 | } |
| 1632 | |
| 1633 | #else |
| 1634 | static inline |
| 1635 | QDF_STATUS lim_fill_adaptive_11r_ie(struct pe_session *pe_session, |
| 1636 | uint8_t **ie_buf, uint8_t *ie_len) |
| 1637 | { |
| 1638 | return QDF_STATUS_SUCCESS; |
| 1639 | } |
| 1640 | #endif |
| 1641 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1642 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1643 | * lim_send_assoc_req_mgmt_frame() - Send association request |
| 1644 | * @mac_ctx: Handle to MAC context |
| 1645 | * @mlm_assoc_req: Association request information |
| 1646 | * @pe_session: PE session information |
| 1647 | * |
| 1648 | * Builds and transmits association request frame to AP. |
| 1649 | * |
| 1650 | * Return: Void |
| 1651 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1652 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1653 | lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1654 | tLimMlmAssocReq *mlm_assoc_req, |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 1655 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1656 | { |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 1657 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1658 | tDot11fAssocRequest *frm; |
| 1659 | uint16_t caps; |
| 1660 | uint8_t *frame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1661 | QDF_STATUS sir_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1662 | tLimMlmAssocCnf assoc_cnf; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1663 | uint32_t bytes = 0, payload, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1664 | uint8_t qos_enabled, wme_enabled, wsm_enabled; |
| 1665 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1666 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1667 | uint16_t add_ie_len; |
| 1668 | uint8_t *add_ie; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 1669 | const uint8_t *wps_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1670 | uint8_t power_caps = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1671 | uint8_t tx_flag = 0; |
| 1672 | uint8_t sme_sessionid = 0; |
| 1673 | bool vht_enabled = false; |
| 1674 | tDot11fIEExtCap extr_ext_cap; |
| 1675 | bool extr_ext_flag = true; |
| 1676 | tpSirMacMgmtHdr mac_hdr; |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1677 | uint32_t ie_offset = 0; |
| 1678 | uint8_t *p_ext_cap = NULL; |
| 1679 | tDot11fIEExtCap bcn_ext_cap; |
| 1680 | uint8_t *bcn_ie = NULL; |
| 1681 | uint32_t bcn_ie_len = 0; |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 1682 | uint32_t aes_block_size_len = 0; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1683 | enum rateid min_rid = RATEID_DEFAULT; |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 1684 | uint8_t *mbo_ie = NULL, *adaptive_11r_ie = NULL; |
| 1685 | uint8_t mbo_ie_len = 0, adaptive_11r_ie_len = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1686 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1687 | if (!pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1688 | pe_err("pe_session is NULL"); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1689 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1690 | return; |
| 1691 | } |
| 1692 | |
| 1693 | sme_sessionid = pe_session->smeSessionId; |
| 1694 | |
| 1695 | /* check this early to avoid unncessary operation */ |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1696 | if (!pe_session->lim_join_req) { |
| 1697 | pe_err("pe_session->lim_join_req is NULL"); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1698 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1699 | return; |
| 1700 | } |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1701 | add_ie_len = pe_session->lim_join_req->addIEAssoc.length; |
| 1702 | add_ie = pe_session->lim_join_req->addIEAssoc.addIEdata; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1703 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1704 | frm = qdf_mem_malloc(sizeof(tDot11fAssocRequest)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1705 | if (!frm) { |
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 | } |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1709 | qdf_mem_zero((uint8_t *) frm, sizeof(tDot11fAssocRequest)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1710 | |
Agrawal Ashish | 0f94b57 | 2016-02-22 13:27:06 +0530 | [diff] [blame] | 1711 | if (add_ie_len && pe_session->is_ext_caps_present) { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1712 | qdf_mem_zero((uint8_t *) &extr_ext_cap, |
| 1713 | sizeof(tDot11fIEExtCap)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1714 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 1715 | add_ie, &add_ie_len, &extr_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1716 | if (QDF_STATUS_SUCCESS != sir_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1717 | extr_ext_flag = false; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1718 | pe_debug("Unable to Stripoff ExtCap IE from Assoc Req"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1719 | } else { |
| 1720 | struct s_ext_cap *p_ext_cap = (struct s_ext_cap *) |
| 1721 | extr_ext_cap.bytes; |
| 1722 | |
| 1723 | if (p_ext_cap->interworking_service) |
| 1724 | p_ext_cap->qos_map = 1; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1725 | extr_ext_cap.num_bytes = |
| 1726 | lim_compute_ext_cap_ie_length(&extr_ext_cap); |
| 1727 | extr_ext_flag = (extr_ext_cap.num_bytes > 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1728 | } |
| 1729 | } else { |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 1730 | 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] | 1731 | extr_ext_flag = false; |
| 1732 | } |
| 1733 | |
| 1734 | caps = mlm_assoc_req->capabilityInfo; |
| 1735 | #if defined(FEATURE_WLAN_WAPI) |
| 1736 | /* |
| 1737 | * According to WAPI standard: |
| 1738 | * 7.3.1.4 Capability Information field |
| 1739 | * In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 |
| 1740 | * in transmitted Association or Reassociation management frames. |
| 1741 | * APs ignore the Privacy subfield within received Association and |
| 1742 | * Reassociation management frames. |
| 1743 | */ |
| 1744 | if (pe_session->encryptType == eSIR_ED_WPI) |
| 1745 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 1746 | #endif |
| 1747 | swap_bit_field16(caps, (uint16_t *) &frm->Capabilities); |
| 1748 | |
| 1749 | frm->ListenInterval.interval = mlm_assoc_req->listenInterval; |
| 1750 | populate_dot11f_ssid2(mac_ctx, &frm->SSID); |
| 1751 | populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1752 | &frm->SuppRates, pe_session); |
| 1753 | |
| 1754 | qos_enabled = (pe_session->limQosEnabled) && |
| 1755 | SIR_MAC_GET_QOS(pe_session->limCurrentBssCaps); |
| 1756 | |
| 1757 | wme_enabled = (pe_session->limWmeEnabled) && |
| 1758 | LIM_BSS_CAPS_GET(WME, pe_session->limCurrentBssQosCaps); |
| 1759 | |
| 1760 | /* We prefer .11e asociations: */ |
| 1761 | if (qos_enabled) |
| 1762 | wme_enabled = false; |
| 1763 | |
| 1764 | wsm_enabled = (pe_session->limWsmEnabled) && wme_enabled && |
| 1765 | LIM_BSS_CAPS_GET(WSM, pe_session->limCurrentBssQosCaps); |
| 1766 | |
| 1767 | if (pe_session->lim11hEnable && |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1768 | pe_session->lim_join_req->spectrumMgtIndicator == true) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1769 | power_caps = true; |
| 1770 | |
| 1771 | populate_dot11f_power_caps(mac_ctx, &frm->PowerCaps, |
| 1772 | LIM_ASSOC, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1773 | populate_dot11f_supp_channels(mac_ctx, &frm->SuppChannels, |
| 1774 | LIM_ASSOC, pe_session); |
| 1775 | |
| 1776 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1777 | if (mac_ctx->rrm.rrmPEContext.rrmEnable && |
| 1778 | SIR_MAC_GET_RRM(pe_session->limCurrentBssCaps)) { |
| 1779 | if (power_caps == false) { |
| 1780 | power_caps = true; |
| 1781 | populate_dot11f_power_caps(mac_ctx, &frm->PowerCaps, |
| 1782 | LIM_ASSOC, pe_session); |
| 1783 | } |
| 1784 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1785 | if (qos_enabled) |
Naveen Rawat | cd11831 | 2016-11-22 10:46:21 -0800 | [diff] [blame] | 1786 | populate_dot11f_qos_caps_station(mac_ctx, pe_session, |
| 1787 | &frm->QOSCapsStation); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1788 | |
| 1789 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 1790 | POPULATE_DOT11F_RATES_OPERATIONAL, &frm->ExtSuppRates, |
| 1791 | pe_session); |
| 1792 | |
Gupta, Kapil | 54a1699 | 2016-01-13 19:34:02 +0530 | [diff] [blame] | 1793 | if (mac_ctx->rrm.rrmPEContext.rrmEnable && |
| 1794 | SIR_MAC_GET_RRM(pe_session->limCurrentBssCaps)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1795 | populate_dot11f_rrm_ie(mac_ctx, &frm->RRMEnabledCap, |
| 1796 | pe_session); |
Deepak Dhamdhere | 641bf32 | 2016-01-06 15:19:03 -0800 | [diff] [blame] | 1797 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1798 | /* |
| 1799 | * The join request *should* contain zero or one of the WPA and RSN |
| 1800 | * IEs. The payload send along with the request is a |
Jeff Johnson | 701444f | 2019-02-02 22:35:13 -0800 | [diff] [blame] | 1801 | * 'struct join_req'; the IE portion is held inside a 'tSirRSNie': |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1802 | * typedef struct sSirRSNie |
| 1803 | * { |
| 1804 | * uint16_t length; |
Srinivas Girigowda | cf16140 | 2019-03-14 11:37:33 -0700 | [diff] [blame] | 1805 | * uint8_t rsnIEdata[WLAN_MAX_IE_LEN+2]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1806 | * } tSirRSNie, *tpSirRSNie; |
| 1807 | * So, we should be able to make the following two calls harmlessly, |
| 1808 | * since they do nothing if they don't find the given IE in the |
| 1809 | * bytestream with which they're provided. |
| 1810 | * The net effect of this will be to faithfully transmit whatever |
| 1811 | * security IE is in the join request. |
| 1812 | * However, if we're associating for the purpose of WPS |
| 1813 | * enrollment, and we've been configured to indicate that by |
| 1814 | * eliding the WPA or RSN IE, we just skip this: |
| 1815 | */ |
| 1816 | if (add_ie_len && add_ie) |
| 1817 | wps_ie = limGetWscIEPtr(mac_ctx, add_ie, add_ie_len); |
| 1818 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1819 | if (!wps_ie) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1820 | populate_dot11f_rsn_opaque(mac_ctx, |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1821 | &pe_session->lim_join_req->rsnIE, |
| 1822 | &frm->RSNOpaque); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1823 | populate_dot11f_wpa_opaque(mac_ctx, |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1824 | &pe_session->lim_join_req->rsnIE, |
| 1825 | &frm->WPAOpaque); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1826 | #if defined(FEATURE_WLAN_WAPI) |
| 1827 | populate_dot11f_wapi_opaque(mac_ctx, |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1828 | &(pe_session->lim_join_req->rsnIE), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1829 | &frm->WAPIOpaque); |
| 1830 | #endif /* defined(FEATURE_WLAN_WAPI) */ |
| 1831 | } |
| 1832 | /* include WME EDCA IE as well */ |
| 1833 | if (wme_enabled) { |
| 1834 | populate_dot11f_wmm_info_station_per_session(mac_ctx, |
| 1835 | pe_session, &frm->WMMInfoStation); |
| 1836 | |
| 1837 | if (wsm_enabled) |
| 1838 | populate_dot11f_wmm_caps(&frm->WMMCaps); |
| 1839 | } |
| 1840 | |
| 1841 | /* |
| 1842 | * Populate HT IEs, when operating in 11n and |
| 1843 | * when AP is also operating in 11n mode |
| 1844 | */ |
| 1845 | if (pe_session->htCapability && |
| 1846 | mac_ctx->lim.htCapabilityPresentInBeacon) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1847 | pe_debug("Populate HT Caps in Assoc Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1848 | populate_dot11f_ht_caps(mac_ctx, pe_session, &frm->HTCaps); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 1849 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 1850 | &frm->HTCaps, sizeof(frm->HTCaps)); |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 1851 | } else if (pe_session->he_with_wep_tkip) { |
| 1852 | pe_debug("Populate HT Caps in Assoc Request with WEP/TKIP"); |
| 1853 | populate_dot11f_ht_caps(mac_ctx, NULL, &frm->HTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1854 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1855 | 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] | 1856 | frm->HTCaps.supportedChannelWidthSet, |
| 1857 | frm->HTCaps.mimoPowerSave, |
| 1858 | frm->HTCaps.greenField, frm->HTCaps.shortGI20MHz, |
| 1859 | frm->HTCaps.shortGI40MHz, |
| 1860 | frm->HTCaps.dsssCckMode40MHz, |
| 1861 | frm->HTCaps.maxRxAMPDUFactor); |
| 1862 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1863 | if (pe_session->vhtCapability && |
| 1864 | pe_session->vhtCapabilityPresentInBeacon) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1865 | pe_debug("Populate VHT IEs in Assoc Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1866 | populate_dot11f_vht_caps(mac_ctx, pe_session, &frm->VHTCaps); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 1867 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 1868 | &frm->VHTCaps, sizeof(frm->VHTCaps)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1869 | vht_enabled = true; |
Kiran Kumar Lokere | 1d4094e | 2016-08-31 19:04:04 -0700 | [diff] [blame] | 1870 | if (pe_session->enableHtSmps && |
| 1871 | !pe_session->supported_nss_1x1) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1872 | pe_err("VHT OP mode IE in Assoc Req"); |
Kiran Kumar Lokere | 1d4094e | 2016-08-31 19:04:04 -0700 | [diff] [blame] | 1873 | populate_dot11f_operating_mode(mac_ctx, |
| 1874 | &frm->OperatingMode, pe_session); |
| 1875 | } |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 1876 | } else if (pe_session->he_with_wep_tkip) { |
| 1877 | pe_debug("Populate VHT IEs in Assoc Request with WEP/TKIP"); |
| 1878 | populate_dot11f_vht_caps(mac_ctx, NULL, &frm->VHTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1879 | } |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 1880 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1881 | if (!vht_enabled && |
| 1882 | pe_session->is_vendor_specific_vhtcaps) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1883 | pe_debug("Populate Vendor VHT IEs in Assoc Request"); |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1884 | frm->vendor_vht_ie.present = 1; |
Kiran Kumar Lokere | 8172263 | 2017-09-26 12:11:43 -0700 | [diff] [blame] | 1885 | frm->vendor_vht_ie.sub_type = |
| 1886 | pe_session->vendor_specific_vht_ie_sub_type; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1887 | frm->vendor_vht_ie.VHTCaps.present = 1; |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 1888 | if (!mac_ctx->mlme_cfg->vht_caps.vht_cap_info.vendor_vhtie && |
Abhishek Singh | 6884428 | 2018-01-25 16:48:41 +0530 | [diff] [blame] | 1889 | pe_session->vht_config.su_beam_formee) { |
| 1890 | pe_debug("Disable SU beamformee for vendor IE"); |
| 1891 | pe_session->vht_config.su_beam_formee = 0; |
| 1892 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1893 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1894 | &frm->vendor_vht_ie.VHTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1895 | vht_enabled = true; |
| 1896 | } |
Agrawal Ashish | 0f94b57 | 2016-02-22 13:27:06 +0530 | [diff] [blame] | 1897 | if (pe_session->is_ext_caps_present) |
| 1898 | populate_dot11f_ext_cap(mac_ctx, vht_enabled, |
| 1899 | &frm->ExtCap, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1900 | |
Wu Gao | 9381621 | 2018-08-31 16:49:54 +0800 | [diff] [blame] | 1901 | if (mac_ctx->mlme_cfg->sta.qcn_ie_support) |
Selvaraj, Sridhar | a521aab | 2017-03-25 16:42:34 +0530 | [diff] [blame] | 1902 | populate_dot11f_qcn_ie(&frm->QCN_IE); |
| 1903 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1904 | if (lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1905 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1906 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1907 | &frm->he_cap); |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 1908 | } else if (pe_session->he_with_wep_tkip) { |
| 1909 | pe_debug("Populate HE IEs in Assoc Request with WEP/TKIP"); |
| 1910 | populate_dot11f_he_caps(mac_ctx, NULL, &frm->he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1911 | } |
Selvaraj, Sridhar | c2fe7a3 | 2017-02-02 19:20:16 +0530 | [diff] [blame] | 1912 | |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1913 | if (pe_session->lim_join_req->is11Rconnection) { |
Pragaspathi Thilagaraj | 1112c96 | 2019-05-23 23:45:38 +0530 | [diff] [blame] | 1914 | struct bss_description *bssdescr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1915 | |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1916 | bssdescr = &pe_session->lim_join_req->bssDescription; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1917 | pe_debug("mdie = %02x %02x %02x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1918 | (unsigned int) bssdescr->mdie[0], |
| 1919 | (unsigned int) bssdescr->mdie[1], |
| 1920 | (unsigned int) bssdescr->mdie[2]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1921 | populate_mdie(mac_ctx, &frm->MobilityDomain, |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1922 | pe_session->lim_join_req->bssDescription.mdie); |
Pragaspathi Thilagaraj | 03839b9 | 2019-03-12 17:45:21 +0530 | [diff] [blame] | 1923 | |
| 1924 | /* |
| 1925 | * IEEE80211-ai [13.2.4 FT initial mobility domain association |
| 1926 | * over FILS in an RSN] |
| 1927 | * Populate FT IE in association request. This FT IE should be |
| 1928 | * same as the FT IE received in auth response frame during the |
| 1929 | * FT-FILS authentication. |
| 1930 | */ |
| 1931 | if (lim_is_fils_connection(pe_session)) |
| 1932 | populate_fils_ft_info(mac_ctx, &frm->FTInfo, |
| 1933 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1934 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1935 | |
| 1936 | #ifdef FEATURE_WLAN_ESE |
| 1937 | /* |
| 1938 | * ESE Version IE will be included in association request |
| 1939 | * when ESE is enabled on DUT through ini and it is also |
| 1940 | * advertised by the peer AP to which we are trying to |
| 1941 | * associate to. |
| 1942 | */ |
| 1943 | if (pe_session->is_ese_version_ie_present && |
Wu Gao | 51a6356 | 2018-11-08 16:29:10 +0800 | [diff] [blame] | 1944 | mac_ctx->mlme_cfg->lfr.ese_enabled) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1945 | populate_dot11f_ese_version(&frm->ESEVersion); |
| 1946 | /* For ESE Associations fill the ESE IEs */ |
| 1947 | if (pe_session->isESEconnection && |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1948 | pe_session->lim_join_req->isESEFeatureIniEnabled) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1949 | #ifndef FEATURE_DISABLE_RM |
| 1950 | populate_dot11f_ese_rad_mgmt_cap(&frm->ESERadMgmtCap); |
| 1951 | #endif |
| 1952 | } |
| 1953 | #endif |
| 1954 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1955 | /* |
| 1956 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 1957 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 1958 | * dot11f get packed payload size. |
| 1959 | */ |
| 1960 | if (extr_ext_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1961 | lim_merge_extcap_struct(&frm->ExtCap, &extr_ext_cap, true); |
| 1962 | |
| 1963 | /* Clear the bits in EXTCAP IE if AP not advertise it in beacon */ |
| 1964 | if (frm->ExtCap.present && pe_session->is_ext_caps_present) { |
| 1965 | ie_offset = DOT11F_FF_TIMESTAMP_LEN + |
| 1966 | DOT11F_FF_BEACONINTERVAL_LEN + |
| 1967 | DOT11F_FF_CAPABILITIES_LEN; |
| 1968 | |
| 1969 | qdf_mem_zero((uint8_t *)&bcn_ext_cap, sizeof(tDot11fIEExtCap)); |
| 1970 | if (pe_session->beacon && pe_session->bcnLen > ie_offset) { |
| 1971 | bcn_ie = pe_session->beacon + ie_offset; |
| 1972 | bcn_ie_len = pe_session->bcnLen - ie_offset; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 1973 | p_ext_cap = (uint8_t *)wlan_get_ie_ptr_from_eid( |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1974 | DOT11F_EID_EXTCAP, |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 1975 | bcn_ie, bcn_ie_len); |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1976 | lim_update_extcap_struct(mac_ctx, p_ext_cap, |
| 1977 | &bcn_ext_cap); |
| 1978 | lim_merge_extcap_struct(&frm->ExtCap, &bcn_ext_cap, |
| 1979 | false); |
| 1980 | } |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 1981 | /* |
| 1982 | * TWT extended capabilities should be populated after the |
| 1983 | * intersection of beacon caps and self caps is done because |
| 1984 | * the bits for TWT are unique to STA and AP and cannot be |
| 1985 | * intersected. |
| 1986 | */ |
| 1987 | populate_dot11f_twt_extended_caps(mac_ctx, pe_session, |
| 1988 | &frm->ExtCap); |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1989 | } |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1990 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1991 | 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] | 1992 | add_ie, &add_ie_len, &frm->SuppOperatingClasses)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1993 | pe_debug("Unable to Stripoff supp op classes IE from Assoc Req"); |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 1994 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 1995 | if (lim_is_fils_connection(pe_session)) { |
| 1996 | populate_dot11f_fils_params(mac_ctx, frm, pe_session); |
| 1997 | aes_block_size_len = AES_BLOCK_SIZE; |
| 1998 | } |
| 1999 | |
| 2000 | /* |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2001 | * MBO IE needs to be appendded at the end of the assoc request |
| 2002 | * frame and is not parsed and unpacked by the frame parser |
| 2003 | * as the supplicant can send multiple TLVs with same Attribute |
| 2004 | * in the MBO IE and the frame parser does not support multiple |
| 2005 | * TLVs with same attribute in a single IE. |
| 2006 | * Strip off the MBO IE from add_ie and append it at the end. |
| 2007 | */ |
| 2008 | if (wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_MBO_OUI, |
| 2009 | SIR_MAC_MBO_OUI_SIZE, add_ie, add_ie_len)) { |
| 2010 | mbo_ie = qdf_mem_malloc(DOT11F_IE_MBO_IE_MAX_LEN + 2); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2011 | if (!mbo_ie) |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2012 | goto end; |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2013 | |
| 2014 | qdf_status = lim_strip_ie(mac_ctx, add_ie, &add_ie_len, |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 2015 | WLAN_ELEMID_VENDOR, ONE_BYTE, |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2016 | SIR_MAC_MBO_OUI, |
| 2017 | SIR_MAC_MBO_OUI_SIZE, |
| 2018 | mbo_ie, DOT11F_IE_MBO_IE_MAX_LEN); |
| 2019 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2020 | pe_err("Failed to strip MBO IE"); |
| 2021 | goto free_mbo_ie; |
| 2022 | } |
| 2023 | |
| 2024 | /* Include the EID and length fields */ |
| 2025 | mbo_ie_len = mbo_ie[1] + 2; |
| 2026 | pe_debug("Stripped MBO IE of length %d", mbo_ie_len); |
| 2027 | } |
| 2028 | |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 2029 | qdf_status = lim_fill_adaptive_11r_ie(pe_session, &adaptive_11r_ie, |
| 2030 | &adaptive_11r_ie_len); |
| 2031 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2032 | pe_err("Failed to fill adaptive 11r IE"); |
| 2033 | goto free_mbo_ie; |
| 2034 | } |
| 2035 | |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2036 | /* |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2037 | * Do unpack to populate the add_ie buffer to frm structure |
| 2038 | * before packing the frm structure. In this way, the IE ordering |
| 2039 | * which the latest 802.11 spec mandates is maintained. |
| 2040 | */ |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 2041 | if (add_ie_len) { |
| 2042 | ret = dot11f_unpack_assoc_request(mac_ctx, add_ie, |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2043 | add_ie_len, frm, true); |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 2044 | if (DOT11F_FAILED(ret)) { |
| 2045 | pe_err("unpack failed, ret: 0x%x", ret); |
| 2046 | goto end; |
| 2047 | } |
| 2048 | } |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2049 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2050 | status = dot11f_get_packed_assoc_request_size(mac_ctx, frm, &payload); |
| 2051 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2052 | pe_err("Association Request packet size failure(0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2053 | status); |
| 2054 | /* We'll fall back on the worst case scenario: */ |
| 2055 | payload = sizeof(tDot11fAssocRequest); |
| 2056 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2057 | pe_warn("Association request packet size warning (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2058 | status); |
| 2059 | } |
| 2060 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2061 | bytes = payload + sizeof(tSirMacMgmtHdr) + |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 2062 | aes_block_size_len + mbo_ie_len + adaptive_11r_ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2063 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2064 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2065 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2066 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2067 | pe_err("Failed to allocate %d bytes", bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2068 | |
| 2069 | pe_session->limMlmState = pe_session->limPrevMlmState; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2070 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_MLM_STATE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2071 | pe_session->peSessionId, |
| 2072 | pe_session->limMlmState)); |
| 2073 | |
| 2074 | /* Update PE session id */ |
| 2075 | assoc_cnf.sessionId = pe_session->peSessionId; |
| 2076 | |
| 2077 | assoc_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2078 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2079 | lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_CNF, |
| 2080 | (uint32_t *) &assoc_cnf); |
| 2081 | |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2082 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2083 | } |
| 2084 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 2085 | qdf_mem_zero(frame, bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2086 | |
| 2087 | /* Next, we fill out the buffer descriptor: */ |
| 2088 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 2089 | SIR_MAC_MGMT_ASSOC_REQ, pe_session->bssId, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 2090 | pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2091 | /* That done, pack the Assoc Request: */ |
| 2092 | status = dot11f_pack_assoc_request(mac_ctx, frm, |
| 2093 | frame + sizeof(tSirMacMgmtHdr), payload, &payload); |
| 2094 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2095 | pe_err("Assoc request pack failure (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2096 | cds_packet_free((void *)packet); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2097 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2098 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2099 | pe_warn("Assoc request pack warning (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2100 | } |
| 2101 | |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2102 | /* Copy the MBO IE to the end of the frame */ |
| 2103 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
| 2104 | mbo_ie, mbo_ie_len); |
| 2105 | payload = payload + mbo_ie_len; |
| 2106 | |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 2107 | /* |
| 2108 | * Copy the Vendor specific Adaptive 11r IE to end of the |
| 2109 | * assoc request frame |
| 2110 | */ |
| 2111 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
| 2112 | adaptive_11r_ie, adaptive_11r_ie_len); |
| 2113 | payload = payload + adaptive_11r_ie_len; |
| 2114 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2115 | if (pe_session->assocReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2116 | qdf_mem_free(pe_session->assocReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2117 | pe_session->assocReq = NULL; |
Naveen Rawat | 83102ef | 2015-11-03 10:42:34 -0800 | [diff] [blame] | 2118 | pe_session->assocReqLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2119 | } |
| 2120 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2121 | if (lim_is_fils_connection(pe_session)) { |
| 2122 | qdf_status = aead_encrypt_assoc_req(mac_ctx, pe_session, |
| 2123 | frame, &payload); |
| 2124 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 2125 | cds_packet_free((void *)packet); |
| 2126 | qdf_mem_free(frm); |
| 2127 | return; |
| 2128 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2129 | } |
| 2130 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2131 | pe_session->assocReq = qdf_mem_malloc(payload); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2132 | if (pe_session->assocReq) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2133 | /* |
| 2134 | * Store the Assoc request. This is sent to csr/hdd in |
| 2135 | * join cnf response. |
| 2136 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2137 | qdf_mem_copy(pe_session->assocReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2138 | frame + sizeof(tSirMacMgmtHdr), payload); |
| 2139 | pe_session->assocReqLen = payload; |
| 2140 | } |
| 2141 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 2142 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) || |
| 2143 | (pe_session->opmode == QDF_P2P_CLIENT_MODE) || |
| 2144 | (pe_session->opmode == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2145 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2146 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 2147 | if (pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 2148 | pe_session->opmode == QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2149 | tx_flag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2150 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2151 | mac_hdr = (tpSirMacMgmtHdr) frame; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2152 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2153 | pe_session->peSessionId, mac_hdr->fc.subType)); |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2154 | |
| 2155 | pe_debug("Sending Association Request length %d to ", bytes); |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2156 | min_rid = lim_get_min_session_txrate(pe_session); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2157 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_START_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2158 | pe_session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2159 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2160 | pe_session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2161 | qdf_status = |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2162 | wma_tx_frameWithTxComplete(mac_ctx, packet, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2163 | (uint16_t) (sizeof(tSirMacMgmtHdr) + payload), |
| 2164 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2165 | lim_tx_complete, frame, lim_assoc_tx_complete_cnf, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2166 | tx_flag, sme_sessionid, false, 0, min_rid); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2167 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2168 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2169 | pe_session->peSessionId, qdf_status)); |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2170 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2171 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2172 | pe_err("Failed to send Association Request (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2173 | qdf_status); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2174 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2175 | pe_session, SENT_FAIL, QDF_STATUS_E_FAILURE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2176 | /* Pkt will be freed up by the callback */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2177 | } |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2178 | free_mbo_ie: |
| 2179 | if (mbo_ie) |
| 2180 | qdf_mem_free(mbo_ie); |
| 2181 | |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2182 | end: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2183 | /* Free up buffer allocated for mlm_assoc_req */ |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 2184 | qdf_mem_free(adaptive_11r_ie); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2185 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2186 | mlm_assoc_req = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2187 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2188 | return; |
| 2189 | } |
| 2190 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2191 | /** |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 2192 | * lim_addba_rsp_tx_complete_cnf() - Confirmation for add BA response OTA |
| 2193 | * @context: pointer to global mac |
| 2194 | * @buf: buffer which is nothing but entire ADD BA frame |
| 2195 | * @tx_complete : Sent status |
| 2196 | * @params; tx completion params |
| 2197 | * |
| 2198 | * Return: This returns QDF_STATUS |
| 2199 | */ |
| 2200 | static QDF_STATUS lim_addba_rsp_tx_complete_cnf(void *context, |
| 2201 | qdf_nbuf_t buf, |
| 2202 | uint32_t tx_complete, |
| 2203 | void *params) |
| 2204 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2205 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 2206 | tSirMacMgmtHdr *mac_hdr; |
| 2207 | tDot11faddba_rsp rsp; |
| 2208 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 2209 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 2210 | uint8_t peer_id; |
| 2211 | void *peer; |
| 2212 | uint32_t frame_len; |
| 2213 | QDF_STATUS status; |
| 2214 | uint8_t *data; |
| 2215 | |
| 2216 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) |
| 2217 | pe_debug("Add ba response successfully sent"); |
| 2218 | else |
| 2219 | pe_debug("Fail to send add ba response"); |
| 2220 | |
| 2221 | if (!buf) { |
| 2222 | pe_err("Addba response frame buffer is NULL"); |
| 2223 | return QDF_STATUS_E_FAILURE; |
| 2224 | } |
| 2225 | |
| 2226 | data = qdf_nbuf_data(buf); |
| 2227 | |
| 2228 | if (!data) { |
| 2229 | pe_err("Addba response frame is NULL"); |
| 2230 | return QDF_STATUS_E_FAILURE; |
| 2231 | } |
| 2232 | |
| 2233 | mac_hdr = (tSirMacMgmtHdr *)data; |
| 2234 | qdf_mem_zero((void *)&rsp, sizeof(tDot11faddba_rsp)); |
| 2235 | frame_len = sizeof(rsp); |
| 2236 | status = dot11f_unpack_addba_rsp(mac_ctx, (uint8_t *)data + |
| 2237 | sizeof(*mac_hdr), frame_len, |
| 2238 | &rsp, false); |
| 2239 | |
| 2240 | if (DOT11F_FAILED(status)) { |
| 2241 | pe_err("Failed to unpack and parse (0x%08x, %d bytes)", |
| 2242 | status, frame_len); |
| 2243 | goto error; |
| 2244 | } |
| 2245 | |
| 2246 | peer = cdp_peer_get_ref_by_addr(soc, pdev, mac_hdr->da, &peer_id, |
| 2247 | PEER_DEBUG_ID_WMA_ADDBA_REQ); |
| 2248 | if (!peer) { |
| 2249 | pe_debug("no PEER found for mac_addr:%pM", mac_hdr->da); |
| 2250 | goto error; |
| 2251 | } |
| 2252 | cdp_addba_resp_tx_completion(soc, peer, rsp.addba_param_set.tid, |
| 2253 | tx_complete); |
| 2254 | cdp_peer_release_ref(soc, peer, PEER_DEBUG_ID_WMA_ADDBA_REQ); |
| 2255 | error: |
| 2256 | if (buf) |
| 2257 | qdf_nbuf_free(buf); |
| 2258 | |
| 2259 | return QDF_STATUS_SUCCESS; |
| 2260 | } |
| 2261 | |
| 2262 | /** |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2263 | * lim_auth_tx_complete_cnf()- Confirmation for auth sent over the air |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2264 | * @context: pointer to global mac |
| 2265 | * @buf: buffer |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2266 | * @tx_complete : Sent status |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2267 | * @params; tx completion params |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2268 | * |
| 2269 | * Return: This returns QDF_STATUS |
| 2270 | */ |
| 2271 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2272 | static QDF_STATUS lim_auth_tx_complete_cnf(void *context, |
| 2273 | qdf_nbuf_t buf, |
| 2274 | uint32_t tx_complete, |
| 2275 | void *params) |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2276 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2277 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2278 | uint16_t auth_ack_status; |
| 2279 | uint16_t reason_code; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2280 | |
Naveen Rawat | 684e8b1 | 2017-09-20 15:54:44 -0700 | [diff] [blame] | 2281 | pe_debug("tx_complete = %d %s", tx_complete, |
Zhu Jianmin | 5d8e3fe | 2018-01-04 16:16:20 +0800 | [diff] [blame] | 2282 | (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) ? |
| 2283 | "success" : "fail"); |
| 2284 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) { |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2285 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_SUCCESS; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2286 | auth_ack_status = ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2287 | reason_code = QDF_STATUS_SUCCESS; |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2288 | /* 'Change' timer for future activations */ |
| 2289 | lim_deactivate_and_change_timer(mac_ctx, eLIM_AUTH_RETRY_TIMER); |
| 2290 | } else { |
| 2291 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2292 | auth_ack_status = NOT_ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2293 | reason_code = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2294 | } |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2295 | |
| 2296 | if (buf) |
| 2297 | qdf_nbuf_free(buf); |
| 2298 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2299 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
| 2300 | NULL, auth_ack_status, reason_code); |
| 2301 | |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2302 | return QDF_STATUS_SUCCESS; |
| 2303 | } |
| 2304 | |
| 2305 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2306 | * lim_send_auth_mgmt_frame() - Send an Authentication frame |
| 2307 | * |
| 2308 | * @mac_ctx: Pointer to Global MAC structure |
| 2309 | * @auth_frame: Pointer to Authentication frame structure |
| 2310 | * @peer_addr: MAC address of destination peer |
| 2311 | * @wep_bit: wep bit in frame control for Authentication frame3 |
| 2312 | * @session: PE session information |
| 2313 | * |
| 2314 | * This function is called by lim_process_mlm_messages(). Authentication frame |
| 2315 | * is formatted and sent when this function is called. |
| 2316 | * |
| 2317 | * Return: void |
| 2318 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2319 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2320 | lim_send_auth_mgmt_frame(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2321 | tpSirMacAuthFrameBody auth_frame, |
| 2322 | tSirMacAddr peer_addr, |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2323 | uint8_t wep_challenge_len, |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 2324 | struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2325 | { |
| 2326 | uint8_t *frame, *body; |
| 2327 | uint32_t frame_len = 0, body_len = 0; |
| 2328 | tpSirMacMgmtHdr mac_hdr; |
| 2329 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2330 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2331 | uint8_t tx_flag = 0; |
| 2332 | uint8_t sme_sessionid = 0; |
| 2333 | uint16_t ft_ies_length = 0; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2334 | bool challenge_req = false; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2335 | enum rateid min_rid = RATEID_DEFAULT; |
Rajasekaran Kalidoss | 7152a35 | 2018-11-19 09:58:35 +0530 | [diff] [blame] | 2336 | uint16_t ch_freq_tx_frame = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2337 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2338 | if (!session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2339 | pe_err("Error: psession Entry is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2340 | return; |
| 2341 | } |
| 2342 | |
| 2343 | sme_sessionid = session->smeSessionId; |
| 2344 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2345 | if (wep_challenge_len) { |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2346 | /* |
| 2347 | * Auth frame3 to be sent with encrypted framebody |
| 2348 | * |
| 2349 | * Allocate buffer for Authenticaton frame of size |
| 2350 | * equal to management frame header length plus 2 bytes |
| 2351 | * each for auth algorithm number, transaction number, |
| 2352 | * status code, 128 bytes for challenge text and |
| 2353 | * 4 bytes each for IV & ICV. |
| 2354 | */ |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2355 | pe_debug("Sending encrypted auth frame to " QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2356 | QDF_MAC_ADDR_ARRAY(peer_addr)); |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2357 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2358 | body_len = wep_challenge_len + LIM_ENCR_AUTH_INFO_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2359 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2360 | |
| 2361 | goto alloc_packet; |
| 2362 | } |
| 2363 | |
Tushnim Bhattacharyya | 332b74c | 2018-08-10 10:55:51 -0700 | [diff] [blame] | 2364 | pe_debug("Sending Auth seq# %d status %d (%d) to " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2365 | QDF_MAC_ADDR_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2366 | auth_frame->authTransactionSeqNumber, |
| 2367 | auth_frame->authStatusCode, |
| 2368 | (auth_frame->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2369 | QDF_MAC_ADDR_ARRAY(peer_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2370 | |
| 2371 | switch (auth_frame->authTransactionSeqNumber) { |
| 2372 | case SIR_MAC_AUTH_FRAME_1: |
| 2373 | /* |
| 2374 | * Allocate buffer for Authenticaton frame of size |
| 2375 | * equal to management frame header length plus 2 bytes |
| 2376 | * each for auth algorithm number, transaction number |
| 2377 | * and status code. |
| 2378 | */ |
| 2379 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2380 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2381 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2382 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2383 | frame_len += lim_create_fils_auth_data(mac_ctx, |
| 2384 | auth_frame, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2385 | if (auth_frame->authAlgoNumber == eSIR_FT_AUTH) { |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2386 | if (session->ftPEContext.pFTPreAuthReq && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2387 | 0 != session->ftPEContext.pFTPreAuthReq-> |
| 2388 | ft_ies_length) { |
| 2389 | ft_ies_length = session->ftPEContext. |
| 2390 | pFTPreAuthReq->ft_ies_length; |
| 2391 | frame_len += ft_ies_length; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2392 | pe_debug("Auth frame, FTIES length added=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2393 | ft_ies_length); |
| 2394 | } else { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2395 | pe_debug("Auth frame, Does not contain FTIES!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2396 | frame_len += (2 + SIR_MDIE_SIZE); |
| 2397 | } |
| 2398 | } |
Pragaspathi Thilagaraj | 239883a | 2019-03-08 00:33:50 +0530 | [diff] [blame] | 2399 | |
| 2400 | /* include MDIE in FILS authentication frame */ |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2401 | if (session->lim_join_req && |
| 2402 | session->lim_join_req->is11Rconnection && |
Pragaspathi Thilagaraj | 239883a | 2019-03-08 00:33:50 +0530 | [diff] [blame] | 2403 | auth_frame->authAlgoNumber == SIR_FILS_SK_WITHOUT_PFS && |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2404 | session->lim_join_req->bssDescription.mdiePresent) |
Pragaspathi Thilagaraj | 239883a | 2019-03-08 00:33:50 +0530 | [diff] [blame] | 2405 | frame_len += (2 + SIR_MDIE_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2406 | break; |
| 2407 | |
| 2408 | case SIR_MAC_AUTH_FRAME_2: |
| 2409 | if ((auth_frame->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 2410 | ((auth_frame->authAlgoNumber == eSIR_SHARED_KEY) && |
| 2411 | (auth_frame->authStatusCode != |
| 2412 | eSIR_MAC_SUCCESS_STATUS))) { |
| 2413 | /* |
| 2414 | * Allocate buffer for Authenticaton frame of size |
| 2415 | * equal to management frame header length plus |
| 2416 | * 2 bytes each for auth algorithm number, |
| 2417 | * transaction number and status code. |
| 2418 | */ |
| 2419 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2420 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2421 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2422 | } else { |
| 2423 | /* |
| 2424 | * Shared Key algorithm with challenge text |
| 2425 | * to be sent. |
| 2426 | * |
| 2427 | * Allocate buffer for Authenticaton frame of size |
| 2428 | * equal to management frame header length plus |
| 2429 | * 2 bytes each for auth algorithm number, |
| 2430 | * transaction number, status code and 128 bytes |
| 2431 | * for challenge text. |
| 2432 | */ |
| 2433 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2434 | challenge_req = true; |
| 2435 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN + |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2436 | SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH + |
| 2437 | SIR_MAC_CHALLENGE_ID_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2438 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2439 | } |
| 2440 | break; |
| 2441 | |
| 2442 | case SIR_MAC_AUTH_FRAME_3: |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2443 | /* |
| 2444 | * Auth frame3 to be sent without encrypted framebody |
| 2445 | * |
| 2446 | * Allocate buffer for Authenticaton frame of size equal |
| 2447 | * to management frame header length plus 2 bytes each |
| 2448 | * for auth algorithm number, transaction number and |
| 2449 | * status code. |
| 2450 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2451 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2452 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2453 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2454 | break; |
| 2455 | |
| 2456 | case SIR_MAC_AUTH_FRAME_4: |
| 2457 | /* |
| 2458 | * Allocate buffer for Authenticaton frame of size equal |
| 2459 | * to management frame header length plus 2 bytes each |
| 2460 | * for auth algorithm number, transaction number and |
| 2461 | * status code. |
| 2462 | */ |
| 2463 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2464 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2465 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2466 | |
| 2467 | break; |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2468 | default: |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2469 | pe_err("Invalid auth transaction seq num"); |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2470 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2471 | } /* switch (auth_frame->authTransactionSeqNumber) */ |
| 2472 | |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2473 | alloc_packet: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2474 | qdf_status = cds_packet_alloc((uint16_t) frame_len, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2475 | (void **)&packet); |
| 2476 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2477 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2478 | pe_err("call to bufAlloc failed for AUTH frame"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2479 | return; |
| 2480 | } |
| 2481 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2482 | qdf_mem_zero(frame, frame_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2483 | |
| 2484 | /* Prepare BD */ |
| 2485 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 2486 | SIR_MAC_MGMT_AUTH, peer_addr, session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2487 | mac_hdr = (tpSirMacMgmtHdr) frame; |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2488 | if (wep_challenge_len) |
| 2489 | mac_hdr->fc.wep = LIM_WEP_IN_FC; |
| 2490 | else |
| 2491 | mac_hdr->fc.wep = LIM_NO_WEP_IN_FC; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2492 | |
| 2493 | /* Prepare BSSId */ |
Rajeev Kumar | cf835a0 | 2016-04-15 15:01:31 -0700 | [diff] [blame] | 2494 | if (LIM_IS_AP_ROLE(session)) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2495 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2496 | (uint8_t *) session->bssId, |
| 2497 | sizeof(tSirMacAddr)); |
| 2498 | |
| 2499 | /* Prepare Authentication frame body */ |
| 2500 | body = frame + sizeof(tSirMacMgmtHdr); |
| 2501 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2502 | if (wep_challenge_len) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2503 | qdf_mem_copy(body, (uint8_t *) auth_frame, body_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2504 | |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2505 | pe_debug("Sending Auth seq# 3 to " QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2506 | QDF_MAC_ADDR_ARRAY(mac_hdr->da)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2507 | |
| 2508 | } else { |
| 2509 | *((uint16_t *) (body)) = |
| 2510 | sir_swap_u16if_needed(auth_frame->authAlgoNumber); |
| 2511 | body += sizeof(uint16_t); |
| 2512 | body_len -= sizeof(uint16_t); |
| 2513 | |
| 2514 | *((uint16_t *) (body)) = |
| 2515 | sir_swap_u16if_needed( |
| 2516 | auth_frame->authTransactionSeqNumber); |
| 2517 | body += sizeof(uint16_t); |
| 2518 | body_len -= sizeof(uint16_t); |
| 2519 | |
| 2520 | *((uint16_t *) (body)) = |
| 2521 | sir_swap_u16if_needed(auth_frame->authStatusCode); |
| 2522 | body += sizeof(uint16_t); |
| 2523 | body_len -= sizeof(uint16_t); |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2524 | |
| 2525 | if (challenge_req) { |
| 2526 | if (body_len < SIR_MAC_AUTH_CHALLENGE_BODY_LEN) { |
Himanshu Agarwal | c422ca7 | 2017-09-19 11:07:36 +0530 | [diff] [blame] | 2527 | /* copy challenge IE id, len, challenge text */ |
| 2528 | *body = auth_frame->type; |
| 2529 | body++; |
| 2530 | body_len -= sizeof(uint8_t); |
| 2531 | *body = auth_frame->length; |
| 2532 | body++; |
| 2533 | body_len -= sizeof(uint8_t); |
| 2534 | qdf_mem_copy(body, auth_frame->challengeText, |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2535 | body_len); |
| 2536 | pe_err("Incomplete challenge info: length: %d, expected: %d", |
| 2537 | body_len, |
| 2538 | SIR_MAC_AUTH_CHALLENGE_BODY_LEN); |
| 2539 | body += body_len; |
| 2540 | body_len = 0; |
| 2541 | } else { |
| 2542 | /* copy challenge IE id, len, challenge text */ |
| 2543 | *body = auth_frame->type; |
| 2544 | body++; |
| 2545 | *body = auth_frame->length; |
| 2546 | body++; |
| 2547 | qdf_mem_copy(body, auth_frame->challengeText, |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2548 | SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH); |
| 2549 | body += SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2550 | |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2551 | body_len -= SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH + |
| 2552 | SIR_MAC_CHALLENGE_ID_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2553 | } |
| 2554 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2555 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2556 | if ((auth_frame->authAlgoNumber == eSIR_FT_AUTH) && |
| 2557 | (auth_frame->authTransactionSeqNumber == |
| 2558 | SIR_MAC_AUTH_FRAME_1) && |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2559 | (session->ftPEContext.pFTPreAuthReq)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2560 | |
| 2561 | if (ft_ies_length > 0) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2562 | qdf_mem_copy(body, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2563 | session->ftPEContext. |
| 2564 | pFTPreAuthReq->ft_ies, |
| 2565 | ft_ies_length); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2566 | pe_debug("Auth1 Frame FTIE is: "); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2567 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, |
| 2568 | QDF_TRACE_LEVEL_DEBUG, |
| 2569 | (uint8_t *) body, |
| 2570 | ft_ies_length); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2571 | } else if (session->ftPEContext. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2572 | pFTPreAuthReq->pbssDescription) { |
| 2573 | /* MDID attr is 54 */ |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 2574 | *body = WLAN_ELEMID_MOBILITY_DOMAIN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2575 | body++; |
| 2576 | *body = SIR_MDIE_SIZE; |
| 2577 | body++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2578 | qdf_mem_copy(body, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2579 | &session->ftPEContext.pFTPreAuthReq-> |
| 2580 | pbssDescription->mdie[0], |
| 2581 | SIR_MDIE_SIZE); |
| 2582 | } |
Pragaspathi Thilagaraj | 239883a | 2019-03-08 00:33:50 +0530 | [diff] [blame] | 2583 | } else if ((auth_frame->authAlgoNumber == |
| 2584 | SIR_FILS_SK_WITHOUT_PFS) && |
| 2585 | (auth_frame->authTransactionSeqNumber == |
| 2586 | SIR_MAC_AUTH_FRAME_1)) { |
| 2587 | pe_debug("FILS: appending fils Auth data"); |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2588 | lim_add_fils_data_to_auth_frame(session, body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2589 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2590 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2591 | pe_debug("*** Sending Auth seq# %d status %d (%d) to " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2592 | QDF_MAC_ADDR_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2593 | auth_frame->authTransactionSeqNumber, |
| 2594 | auth_frame->authStatusCode, |
| 2595 | (auth_frame->authStatusCode == |
| 2596 | eSIR_MAC_SUCCESS_STATUS), |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2597 | QDF_MAC_ADDR_ARRAY(mac_hdr->da)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2598 | } |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2599 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, |
| 2600 | QDF_TRACE_LEVEL_DEBUG, |
| 2601 | frame, frame_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2602 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2603 | if ((session->ftPEContext.pFTPreAuthReq) && |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 2604 | (BAND_5G == lim_get_rf_band( |
Deepthi Gowri | 1de51e3 | 2016-09-01 15:47:28 +0530 | [diff] [blame] | 2605 | session->ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2606 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 2607 | else if ((BAND_5G == lim_get_rf_band(session->currentOperChannel)) || |
| 2608 | (session->opmode == QDF_P2P_CLIENT_MODE) || |
| 2609 | (session->opmode == QDF_P2P_GO_MODE)) |
Deepthi Gowri | 1de51e3 | 2016-09-01 15:47:28 +0530 | [diff] [blame] | 2610 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2611 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 2612 | if (session->opmode == QDF_P2P_CLIENT_MODE || |
| 2613 | session->opmode == QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2614 | tx_flag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2615 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2616 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2617 | session->peSessionId, mac_hdr->fc.subType)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2618 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2619 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_NOT_RCD; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2620 | min_rid = lim_get_min_session_txrate(session); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2621 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2622 | session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Rajasekaran Kalidoss | 7152a35 | 2018-11-19 09:58:35 +0530 | [diff] [blame] | 2623 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2624 | if (session->ftPEContext.pFTPreAuthReq) |
Rajasekaran Kalidoss | 7152a35 | 2018-11-19 09:58:35 +0530 | [diff] [blame] | 2625 | ch_freq_tx_frame = cds_chan_to_freq( |
| 2626 | session->ftPEContext.pFTPreAuthReq->preAuthchannelNum); |
| 2627 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2628 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 2629 | (uint16_t)frame_len, |
| 2630 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 2631 | 7, lim_tx_complete, frame, |
| 2632 | lim_auth_tx_complete_cnf, |
Rajasekaran Kalidoss | 7152a35 | 2018-11-19 09:58:35 +0530 | [diff] [blame] | 2633 | tx_flag, sme_sessionid, false, |
| 2634 | ch_freq_tx_frame, min_rid); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2635 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 2636 | session->peSessionId, qdf_status)); |
| 2637 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 2638 | pe_err("*** Could not send Auth frame, retCode=%X ***", |
| 2639 | qdf_status); |
| 2640 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
| 2641 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2642 | session, SENT_FAIL, QDF_STATUS_E_FAILURE); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2643 | /* Pkt will be freed up by the callback */ |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2644 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2645 | return; |
| 2646 | } |
| 2647 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2648 | QDF_STATUS lim_send_deauth_cnf(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2649 | { |
| 2650 | uint16_t aid; |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2651 | tpDphHashNode sta_ds; |
| 2652 | tLimMlmDeauthReq *deauth_req; |
| 2653 | tLimMlmDeauthCnf deauth_cnf; |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 2654 | struct pe_session *session_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2655 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2656 | deauth_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 2657 | if (deauth_req) { |
| 2658 | if (tx_timer_running( |
| 2659 | &mac_ctx->lim.limTimers.gLimDeauthAckTimer)) |
| 2660 | lim_deactivate_and_change_timer(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2661 | eLIM_DEAUTH_ACK_TIMER); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2662 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2663 | session_entry = pe_find_session_by_session_id(mac_ctx, |
| 2664 | deauth_req->sessionId); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2665 | if (!session_entry) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2666 | pe_err("session does not exist for given sessionId"); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2667 | deauth_cnf.resultCode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2668 | eSIR_SME_INVALID_PARAMETERS; |
| 2669 | goto end; |
| 2670 | } |
| 2671 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2672 | sta_ds = |
| 2673 | dph_lookup_hash_entry(mac_ctx, |
| 2674 | deauth_req->peer_macaddr.bytes, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 2675 | &aid, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2676 | &session_entry->dph.dphHashTable); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2677 | if (!sta_ds) { |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2678 | deauth_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2679 | goto end; |
| 2680 | } |
| 2681 | |
| 2682 | /* / Receive path cleanup with dummy packet */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2683 | lim_ft_cleanup_pre_auth_info(mac_ctx, session_entry); |
| 2684 | lim_cleanup_rx_path(mac_ctx, sta_ds, session_entry); |
| 2685 | if ((session_entry->limSystemRole == eLIM_STA_ROLE) && |
| 2686 | ( |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 2687 | #ifdef FEATURE_WLAN_ESE |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2688 | (session_entry->isESEconnection) || |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 2689 | #endif |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2690 | (session_entry->isFastRoamIniFeatureEnabled) || |
| 2691 | (session_entry->is11Rconnection))) { |
Jeff Johnson | 11bd4f3 | 2017-09-18 08:15:17 -0700 | [diff] [blame] | 2692 | pe_debug("FT Preauth (%pK,%d) Deauth rc %d src = %d", |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2693 | session_entry, |
| 2694 | session_entry->peSessionId, |
| 2695 | deauth_req->reasonCode, |
| 2696 | deauth_req->deauthTrigger); |
| 2697 | lim_ft_cleanup(mac_ctx, session_entry); |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2698 | } else { |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2699 | #ifdef FEATURE_WLAN_ESE |
Nirav Shah | f359dd2 | 2019-02-20 10:34:28 +0530 | [diff] [blame] | 2700 | pe_debug("No FT Preauth Session Cleanup in role %d" |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2701 | " isESE %d" |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2702 | " isLFR %d" |
| 2703 | " is11r %d, Deauth reason %d Trigger = %d", |
| 2704 | session_entry->limSystemRole, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2705 | session_entry->isESEconnection, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2706 | session_entry->isFastRoamIniFeatureEnabled, |
| 2707 | session_entry->is11Rconnection, |
| 2708 | deauth_req->reasonCode, |
| 2709 | deauth_req->deauthTrigger); |
Nirav Shah | f359dd2 | 2019-02-20 10:34:28 +0530 | [diff] [blame] | 2710 | #else |
| 2711 | pe_debug("No FT Preauth Session Cleanup in role %d" |
| 2712 | " isLFR %d" |
| 2713 | " is11r %d, Deauth reason %d Trigger = %d", |
| 2714 | session_entry->limSystemRole, |
| 2715 | session_entry->isFastRoamIniFeatureEnabled, |
| 2716 | session_entry->is11Rconnection, |
| 2717 | deauth_req->reasonCode, |
| 2718 | deauth_req->deauthTrigger); |
| 2719 | #endif |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2720 | } |
| 2721 | /* Free up buffer allocated for mlmDeauthReq */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2722 | qdf_mem_free(deauth_req); |
| 2723 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2724 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2725 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2726 | end: |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2727 | qdf_copy_macaddr(&deauth_cnf.peer_macaddr, |
| 2728 | &deauth_req->peer_macaddr); |
| 2729 | deauth_cnf.deauthTrigger = deauth_req->deauthTrigger; |
| 2730 | deauth_cnf.aid = deauth_req->aid; |
| 2731 | deauth_cnf.sessionId = deauth_req->sessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2732 | |
| 2733 | /* Free up buffer allocated */ |
| 2734 | /* for mlmDeauthReq */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2735 | qdf_mem_free(deauth_req); |
| 2736 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2737 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2738 | lim_post_sme_message(mac_ctx, |
| 2739 | LIM_MLM_DEAUTH_CNF, (uint32_t *) &deauth_cnf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2740 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2741 | } |
| 2742 | |
| 2743 | /** |
| 2744 | * lim_send_disassoc_cnf() - Send disassoc confirmation to SME |
| 2745 | * |
| 2746 | * @mac_ctx: Handle to MAC context |
| 2747 | * |
| 2748 | * Sends disassoc confirmation to SME. Removes disassoc request stored |
| 2749 | * in lim. |
| 2750 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2751 | * Return: QDF_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2752 | */ |
| 2753 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2754 | QDF_STATUS lim_send_disassoc_cnf(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2755 | { |
| 2756 | uint16_t aid; |
| 2757 | tpDphHashNode sta_ds; |
| 2758 | tLimMlmDisassocCnf disassoc_cnf; |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 2759 | struct pe_session *pe_session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2760 | tLimMlmDisassocReq *disassoc_req; |
| 2761 | |
| 2762 | disassoc_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 2763 | if (disassoc_req) { |
| 2764 | if (tx_timer_running( |
| 2765 | &mac_ctx->lim.limTimers.gLimDisassocAckTimer)) |
| 2766 | lim_deactivate_and_change_timer(mac_ctx, |
| 2767 | eLIM_DISASSOC_ACK_TIMER); |
| 2768 | |
| 2769 | pe_session = pe_find_session_by_session_id( |
| 2770 | mac_ctx, disassoc_req->sessionId); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2771 | if (!pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2772 | pe_err("No session for given sessionId"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2773 | disassoc_cnf.resultCode = |
| 2774 | eSIR_SME_INVALID_PARAMETERS; |
| 2775 | goto end; |
| 2776 | } |
| 2777 | |
| 2778 | sta_ds = dph_lookup_hash_entry(mac_ctx, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 2779 | disassoc_req->peer_macaddr.bytes, &aid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2780 | &pe_session->dph.dphHashTable); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2781 | if (!sta_ds) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2782 | pe_err("StaDs Null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2783 | disassoc_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 2784 | goto end; |
| 2785 | } |
| 2786 | /* Receive path cleanup with dummy packet */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2787 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2788 | lim_cleanup_rx_path(mac_ctx, sta_ds, pe_session)) { |
| 2789 | disassoc_cnf.resultCode = |
| 2790 | eSIR_SME_RESOURCES_UNAVAILABLE; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2791 | pe_err("cleanup_rx_path error"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2792 | goto end; |
| 2793 | } |
Deepak Dhamdhere | 57c95ff | 2016-09-30 16:44:44 -0700 | [diff] [blame] | 2794 | if (LIM_IS_STA_ROLE(pe_session) && |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2795 | (disassoc_req->reasonCode != |
| 2796 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) { |
Jeff Johnson | 11bd4f3 | 2017-09-18 08:15:17 -0700 | [diff] [blame] | 2797 | pe_debug("FT Preauth Session (%pK %d) Clean up", |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2798 | pe_session, pe_session->peSessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2799 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2800 | /* Delete FT session if there exists one */ |
| 2801 | lim_ft_cleanup_pre_auth_info(mac_ctx, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2802 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2803 | /* Free up buffer allocated for mlmDisassocReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2804 | qdf_mem_free(disassoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2805 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2806 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2807 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2808 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2809 | } |
| 2810 | end: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2811 | qdf_mem_copy((uint8_t *) &disassoc_cnf.peerMacAddr, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 2812 | (uint8_t *) disassoc_req->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2813 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2814 | disassoc_cnf.aid = disassoc_req->aid; |
| 2815 | disassoc_cnf.disassocTrigger = disassoc_req->disassocTrigger; |
| 2816 | |
| 2817 | /* Update PE session ID */ |
| 2818 | disassoc_cnf.sessionId = disassoc_req->sessionId; |
| 2819 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2820 | if (disassoc_req) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2821 | /* / Free up buffer allocated for mlmDisassocReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2822 | qdf_mem_free(disassoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2823 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 2824 | } |
| 2825 | |
| 2826 | lim_post_sme_message(mac_ctx, LIM_MLM_DISASSOC_CNF, |
| 2827 | (uint32_t *) &disassoc_cnf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2828 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2829 | } |
| 2830 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2831 | QDF_STATUS lim_disassoc_tx_complete_cnf(void *context, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2832 | uint32_t tx_success, |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2833 | void *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2834 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2835 | struct mac_context *max_ctx = (struct mac_context *)context; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2836 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2837 | pe_debug("tx_success: %d", tx_success); |
| 2838 | |
| 2839 | return lim_send_disassoc_cnf(max_ctx); |
| 2840 | } |
| 2841 | |
| 2842 | static QDF_STATUS lim_disassoc_tx_complete_cnf_handler(void *context, |
| 2843 | qdf_nbuf_t buf, |
| 2844 | uint32_t tx_success, |
| 2845 | void *params) |
| 2846 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2847 | struct mac_context *max_ctx = (struct mac_context *)context; |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2848 | QDF_STATUS status_code; |
| 2849 | struct scheduler_msg msg = {0}; |
| 2850 | |
| 2851 | pe_debug("tx_success: %d", tx_success); |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2852 | |
| 2853 | if (buf) |
| 2854 | qdf_nbuf_free(buf); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2855 | msg.type = (uint16_t) WMA_DISASSOC_TX_COMP; |
| 2856 | msg.bodyptr = params; |
| 2857 | msg.bodyval = tx_success; |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2858 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2859 | status_code = lim_post_msg_high_priority(max_ctx, &msg); |
| 2860 | if (status_code != QDF_STATUS_SUCCESS) |
| 2861 | pe_err("posting message: %X to LIM failed, reason: %d", |
| 2862 | msg.type, status_code); |
| 2863 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2864 | } |
| 2865 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2866 | QDF_STATUS lim_deauth_tx_complete_cnf(void *context, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2867 | uint32_t tx_success, |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2868 | void *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2869 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2870 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2871 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2872 | pe_debug("tx_success: %d", tx_success); |
| 2873 | |
| 2874 | return lim_send_deauth_cnf(mac_ctx); |
| 2875 | } |
| 2876 | |
| 2877 | static QDF_STATUS lim_deauth_tx_complete_cnf_handler(void *context, |
| 2878 | qdf_nbuf_t buf, |
| 2879 | uint32_t tx_success, |
| 2880 | void *params) |
| 2881 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2882 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2883 | QDF_STATUS status_code; |
| 2884 | struct scheduler_msg msg = {0}; |
| 2885 | |
| 2886 | pe_debug("tx_success: %d", tx_success); |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2887 | |
| 2888 | if (buf) |
| 2889 | qdf_nbuf_free(buf); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2890 | msg.type = (uint16_t) WMA_DEAUTH_TX_COMP; |
| 2891 | msg.bodyptr = params; |
| 2892 | msg.bodyval = tx_success; |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2893 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2894 | status_code = lim_post_msg_high_priority(mac_ctx, &msg); |
| 2895 | if (status_code != QDF_STATUS_SUCCESS) |
| 2896 | pe_err("posting message: %X to LIM failed, reason: %d", |
| 2897 | msg.type, status_code); |
| 2898 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2899 | } |
| 2900 | |
| 2901 | /** |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 2902 | * lim_append_ies_to_frame() - Append IEs to the frame |
| 2903 | * |
| 2904 | * @frame: Pointer to the frame buffer that needs to be populated |
| 2905 | * @frame_len: Pointer for current frame length |
| 2906 | * @ie: pointer for disconnect IEs |
| 2907 | * |
| 2908 | * This function is called by lim_send_disassoc_mgmt_frame and |
| 2909 | * lim_send_deauth_mgmt_frame APIs as part of disconnection. |
| 2910 | * Append IEs and update frame length. |
| 2911 | * |
| 2912 | * Return: None |
| 2913 | */ |
| 2914 | static void |
| 2915 | lim_append_ies_to_frame(uint8_t *frame, uint32_t *frame_len, |
| 2916 | struct wlan_ies *ie) |
| 2917 | { |
| 2918 | if (!ie || !ie->len || !ie->data) |
| 2919 | return; |
| 2920 | qdf_mem_copy(frame, ie->data, ie->len); |
| 2921 | *frame_len += ie->len; |
| 2922 | pe_debug("Appended IEs len: %u", ie->len); |
| 2923 | } |
| 2924 | |
| 2925 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2926 | * \brief This function is called to send Disassociate frame. |
| 2927 | * |
| 2928 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 2929 | * \param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2930 | * |
| 2931 | * \param nReason Indicates the reason that need to be sent in |
| 2932 | * Disassociation frame |
| 2933 | * |
| 2934 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 2935 | * sent |
| 2936 | * |
| 2937 | * |
| 2938 | */ |
| 2939 | |
| 2940 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2941 | lim_send_disassoc_mgmt_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2942 | uint16_t nReason, |
| 2943 | tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2944 | struct pe_session *pe_session, bool waitForAck) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2945 | { |
| 2946 | tDot11fDisassociation frm; |
| 2947 | uint8_t *pFrame; |
| 2948 | tpSirMacMgmtHdr pMacHdr; |
| 2949 | uint32_t nBytes, nPayload, nStatus; |
| 2950 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2951 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2952 | uint8_t txFlag = 0; |
| 2953 | uint32_t val = 0; |
| 2954 | uint8_t smeSessionId = 0; |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 2955 | struct wlan_ies *discon_ie; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 2956 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2957 | if (!pe_session) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2958 | return; |
| 2959 | } |
| 2960 | |
| 2961 | /* |
| 2962 | * In case when cac timer is running for this SAP session then |
| 2963 | * avoid sending disassoc out. It is violation of dfs specification. |
| 2964 | */ |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 2965 | if (((pe_session->opmode == QDF_SAP_MODE) || |
| 2966 | (pe_session->opmode == QDF_P2P_GO_MODE)) && |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 2967 | (true == mac->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2968 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 2969 | FL("CAC timer is running, drop disassoc from going out")); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 2970 | if (waitForAck) |
| 2971 | lim_send_disassoc_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2972 | return; |
| 2973 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2974 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2975 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 2976 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2977 | |
| 2978 | frm.Reason.code = nReason; |
| 2979 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 2980 | nStatus = dot11f_get_packed_disassociation_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2981 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2982 | 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] | 2983 | nStatus); |
| 2984 | /* We'll fall back on the worst case scenario: */ |
| 2985 | nPayload = sizeof(tDot11fDisassociation); |
| 2986 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2987 | pe_warn("There were warnings while calculating the packed size for a Disassociation (0x%08x)", |
| 2988 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2989 | } |
| 2990 | |
| 2991 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 2992 | |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 2993 | discon_ie = mlme_get_self_disconnect_ies(pe_session->vdev); |
| 2994 | if (discon_ie && discon_ie->len) |
| 2995 | nBytes += discon_ie->len; |
| 2996 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2997 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2998 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2999 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3000 | pe_err("Failed to allocate %d bytes for a Disassociation", |
| 3001 | nBytes); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3002 | if (waitForAck) |
| 3003 | lim_send_disassoc_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3004 | return; |
| 3005 | } |
| 3006 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3007 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3008 | |
| 3009 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3010 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3011 | SIR_MAC_MGMT_DISASSOC, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3012 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3013 | |
| 3014 | /* Prepare the BSSID */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3015 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3016 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3017 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3018 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3019 | nStatus = dot11f_pack_disassociation(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3020 | sizeof(tSirMacMgmtHdr), |
| 3021 | nPayload, &nPayload); |
| 3022 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3023 | pe_err("Failed to pack a Disassociation (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3024 | nStatus); |
| 3025 | cds_packet_free((void *)pPacket); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3026 | if (waitForAck) |
| 3027 | lim_send_disassoc_cnf(mac); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3028 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3029 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3030 | pe_warn("There were warnings while packing a Disassociation (0x%08x)", |
| 3031 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3032 | } |
| 3033 | |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3034 | /* Copy disconnect IEs to the end of the frame */ |
| 3035 | lim_append_ies_to_frame(pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3036 | &nPayload, discon_ie); |
| 3037 | mlme_free_self_disconnect_ies(pe_session->vdev); |
| 3038 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3039 | pe_debug("***Sessionid %d Sending Disassociation frame with " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3040 | "reason %u and waitForAck %d to " QDF_MAC_ADDR_STR " ,From " |
| 3041 | QDF_MAC_ADDR_STR, pe_session->peSessionId, nReason, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3042 | waitForAck, QDF_MAC_ADDR_ARRAY(pMacHdr->da), |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3043 | QDF_MAC_ADDR_ARRAY(pe_session->self_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3044 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3045 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) || |
| 3046 | (pe_session->opmode == QDF_P2P_CLIENT_MODE) || |
| 3047 | (pe_session->opmode == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3048 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3049 | |
Sushant Kaushik | 4655606 | 2015-12-02 16:57:47 +0530 | [diff] [blame] | 3050 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3051 | |
| 3052 | if (waitForAck) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3053 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3054 | pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3055 | pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3056 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3057 | pe_session, QDF_STATUS_SUCCESS, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3058 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3059 | /* Queue Disassociation frame in high priority WQ */ |
| 3060 | /* get the duration from the request */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3061 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3062 | wma_tx_frameWithTxComplete(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3063 | TXRX_FRM_802_11_MGMT, |
| 3064 | ANI_TXDIR_TODS, 7, lim_tx_complete, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3065 | pFrame, lim_disassoc_tx_complete_cnf_handler, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3066 | txFlag, smeSessionId, false, 0, |
| 3067 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3068 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3069 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3070 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3071 | |
| 3072 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 3073 | |
| 3074 | if (tx_timer_change |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3075 | (&mac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3076 | != TX_SUCCESS) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3077 | pe_err("Unable to change Disassoc ack Timer val"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3078 | return; |
| 3079 | } else if (TX_SUCCESS != |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3080 | tx_timer_activate(&mac->lim.limTimers. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3081 | gLimDisassocAckTimer)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3082 | pe_err("Unable to activate Disassoc ack Timer"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3083 | lim_deactivate_and_change_timer(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3084 | eLIM_DISASSOC_ACK_TIMER); |
| 3085 | return; |
| 3086 | } |
| 3087 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3088 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3089 | pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3090 | pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3091 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3092 | pe_session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3093 | QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3094 | /* Queue Disassociation frame in high priority WQ */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3095 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3096 | TXRX_FRM_802_11_MGMT, |
| 3097 | ANI_TXDIR_TODS, |
| 3098 | 7, |
| 3099 | lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3100 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3101 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3102 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3103 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3104 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3105 | pe_err("Failed to send Disassociation (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3106 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3107 | /* Pkt will be freed up by the callback */ |
| 3108 | } |
| 3109 | } |
| 3110 | } /* End lim_send_disassoc_mgmt_frame. */ |
| 3111 | |
| 3112 | /** |
| 3113 | * \brief This function is called to send a Deauthenticate frame |
| 3114 | * |
| 3115 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3116 | * \param mac Pointer to global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3117 | * |
| 3118 | * \param nReason Indicates the reason that need to be sent in the |
| 3119 | * Deauthenticate frame |
| 3120 | * |
| 3121 | * \param peeer address of the STA to which the frame is to be sent |
| 3122 | * |
| 3123 | * |
| 3124 | */ |
| 3125 | |
| 3126 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3127 | lim_send_deauth_mgmt_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3128 | uint16_t nReason, |
| 3129 | tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3130 | struct pe_session *pe_session, bool waitForAck) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3131 | { |
| 3132 | tDot11fDeAuth frm; |
| 3133 | uint8_t *pFrame; |
| 3134 | tpSirMacMgmtHdr pMacHdr; |
| 3135 | uint32_t nBytes, nPayload, nStatus; |
| 3136 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3137 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3138 | uint8_t txFlag = 0; |
| 3139 | uint32_t val = 0; |
| 3140 | #ifdef FEATURE_WLAN_TDLS |
| 3141 | uint16_t aid; |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3142 | tpDphHashNode sta; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3143 | #endif |
| 3144 | uint8_t smeSessionId = 0; |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3145 | struct wlan_ies *discon_ie; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3146 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3147 | if (!pe_session) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3148 | return; |
| 3149 | } |
| 3150 | |
| 3151 | /* |
| 3152 | * In case when cac timer is running for this SAP session then |
| 3153 | * avoid deauth frame out. It is violation of dfs specification. |
| 3154 | */ |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3155 | if (((pe_session->opmode == QDF_SAP_MODE) || |
| 3156 | (pe_session->opmode == QDF_P2P_GO_MODE)) && |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3157 | (true == mac->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3158 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3159 | FL |
| 3160 | ("CAC timer is running, drop the deauth from going out")); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3161 | if (waitForAck) |
| 3162 | lim_send_deauth_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3163 | return; |
| 3164 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3165 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3166 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3167 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3168 | |
| 3169 | frm.Reason.code = nReason; |
| 3170 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3171 | nStatus = dot11f_get_packed_de_auth_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3172 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3173 | 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] | 3174 | nStatus); |
| 3175 | /* We'll fall back on the worst case scenario: */ |
| 3176 | nPayload = sizeof(tDot11fDeAuth); |
| 3177 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3178 | pe_warn("There were warnings while calculating the packed size for a De-Authentication (0x%08x)", |
| 3179 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3180 | } |
| 3181 | |
| 3182 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3183 | discon_ie = mlme_get_self_disconnect_ies(pe_session->vdev); |
| 3184 | if (discon_ie && discon_ie->len) |
| 3185 | nBytes += discon_ie->len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3186 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3187 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3188 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3189 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3190 | pe_err("Failed to allocate %d bytes for a De-Authentication", |
| 3191 | nBytes); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3192 | if (waitForAck) |
| 3193 | lim_send_deauth_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3194 | return; |
| 3195 | } |
| 3196 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3197 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3198 | |
| 3199 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3200 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3201 | SIR_MAC_MGMT_DEAUTH, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3202 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3203 | |
| 3204 | /* Prepare the BSSID */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3205 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3206 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3207 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3208 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3209 | nStatus = dot11f_pack_de_auth(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3210 | sizeof(tSirMacMgmtHdr), nPayload, &nPayload); |
| 3211 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3212 | pe_err("Failed to pack a DeAuthentication (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3213 | nStatus); |
| 3214 | cds_packet_free((void *)pPacket); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3215 | if (waitForAck) |
| 3216 | lim_send_deauth_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3217 | return; |
| 3218 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3219 | pe_warn("There were warnings while packing a De-Authentication (0x%08x)", |
| 3220 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3221 | } |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3222 | |
| 3223 | /* Copy disconnect IEs to the end of the frame */ |
| 3224 | lim_append_ies_to_frame(pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3225 | &nPayload, discon_ie); |
| 3226 | mlme_free_self_disconnect_ies(pe_session->vdev); |
| 3227 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3228 | pe_debug("***Sessionid %d Sending Deauth frame with " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3229 | "reason %u and waitForAck %d to " QDF_MAC_ADDR_STR |
| 3230 | " ,From " QDF_MAC_ADDR_STR, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3231 | pe_session->peSessionId, nReason, waitForAck, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3232 | QDF_MAC_ADDR_ARRAY(pMacHdr->da), |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3233 | QDF_MAC_ADDR_ARRAY(pe_session->self_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3234 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3235 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) || |
| 3236 | (pe_session->opmode == QDF_P2P_CLIENT_MODE) || |
| 3237 | (pe_session->opmode == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3238 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3239 | |
Sushant Kaushik | 4655606 | 2015-12-02 16:57:47 +0530 | [diff] [blame] | 3240 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3241 | #ifdef FEATURE_WLAN_TDLS |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3242 | sta = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3243 | dph_lookup_hash_entry(mac, peer, &aid, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3244 | &pe_session->dph.dphHashTable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3245 | #endif |
| 3246 | |
| 3247 | if (waitForAck) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3248 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3249 | pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3250 | pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3251 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3252 | pe_session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3253 | QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3254 | /* Queue Disassociation frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3255 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3256 | wma_tx_frameWithTxComplete(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3257 | TXRX_FRM_802_11_MGMT, |
| 3258 | ANI_TXDIR_TODS, 7, lim_tx_complete, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3259 | pFrame, lim_deauth_tx_complete_cnf_handler, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3260 | txFlag, smeSessionId, false, 0, |
| 3261 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3262 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3263 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3264 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3265 | /* Pkt will be freed up by the callback lim_tx_complete */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3266 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3267 | pe_err("Failed to send De-Authentication (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3268 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3269 | |
| 3270 | /* Call lim_process_deauth_ack_timeout which will send |
| 3271 | * DeauthCnf for this frame |
| 3272 | */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3273 | lim_process_deauth_ack_timeout(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3274 | return; |
| 3275 | } |
| 3276 | |
| 3277 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 3278 | |
| 3279 | if (tx_timer_change |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3280 | (&mac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3281 | != TX_SUCCESS) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3282 | pe_err("Unable to change Deauth ack Timer val"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3283 | return; |
| 3284 | } else if (TX_SUCCESS != |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3285 | tx_timer_activate(&mac->lim.limTimers. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3286 | gLimDeauthAckTimer)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3287 | pe_err("Unable to activate Deauth ack Timer"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3288 | lim_deactivate_and_change_timer(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3289 | eLIM_DEAUTH_ACK_TIMER); |
| 3290 | return; |
| 3291 | } |
| 3292 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3293 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3294 | pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3295 | pMacHdr->fc.subType)); |
| 3296 | #ifdef FEATURE_WLAN_TDLS |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3297 | if ((sta) |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3298 | && (STA_ENTRY_TDLS_PEER == sta->staType)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3299 | /* Queue Disassociation frame in high priority WQ */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3300 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3301 | pe_session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3302 | QDF_STATUS_SUCCESS, |
| 3303 | QDF_STATUS_SUCCESS); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3304 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3305 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3306 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_IBSS, |
| 3307 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3308 | smeSessionId, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3309 | } else { |
| 3310 | #endif |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3311 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3312 | pe_session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3313 | QDF_STATUS_SUCCESS, |
| 3314 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3315 | /* Queue Disassociation frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3316 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3317 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3318 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3319 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3320 | smeSessionId, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3321 | #ifdef FEATURE_WLAN_TDLS |
| 3322 | } |
| 3323 | #endif |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3324 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3325 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3326 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3327 | pe_err("Failed to send De-Authentication (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3328 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3329 | /* Pkt will be freed up by the callback */ |
| 3330 | } |
| 3331 | } |
| 3332 | |
| 3333 | } /* End lim_send_deauth_mgmt_frame. */ |
| 3334 | |
| 3335 | #ifdef ANI_SUPPORT_11H |
| 3336 | /** |
| 3337 | * \brief Send a Measurement Report Action frame |
| 3338 | * |
| 3339 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3340 | * \param mac Pointer to the global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3341 | * |
| 3342 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 3343 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3344 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3345 | * |
| 3346 | * |
| 3347 | */ |
| 3348 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3349 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3350 | lim_send_meas_report_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3351 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3352 | tSirMacAddr peer, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3353 | { |
| 3354 | tDot11fMeasurementReport frm; |
| 3355 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3356 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3357 | tpSirMacMgmtHdr pMacHdr; |
| 3358 | uint32_t nBytes, nPayload, nStatus; |
| 3359 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3360 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3361 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3362 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3363 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 3364 | frm.Category.category = ACTION_CATEGORY_SPECTRUM_MGMT; |
Srinivas Girigowda | f8e5d2e | 2019-05-28 11:49:29 -0700 | [diff] [blame] | 3365 | frm.Action.action = ACTION_SPCT_MSR_RPRT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3366 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 3367 | |
| 3368 | switch (pMeasReqFrame->measReqIE.measType) { |
| 3369 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 3370 | nSirStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3371 | populate_dot11f_measurement_report0(mac, pMeasReqFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3372 | &frm.MeasurementReport); |
| 3373 | break; |
| 3374 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 3375 | nSirStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3376 | populate_dot11f_measurement_report1(mac, pMeasReqFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3377 | &frm.MeasurementReport); |
| 3378 | break; |
| 3379 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 3380 | nSirStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3381 | populate_dot11f_measurement_report2(mac, pMeasReqFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3382 | &frm.MeasurementReport); |
| 3383 | break; |
| 3384 | default: |
Jeff Johnson | 0711e27 | 2018-12-14 23:16:38 -0800 | [diff] [blame] | 3385 | pe_err("Unknown measurement type %d in limSendMeasReportFrame", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3386 | pMeasReqFrame->measReqIE.measType); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3387 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3388 | } |
| 3389 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3390 | if (QDF_STATUS_SUCCESS != nSirStatus) |
| 3391 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3392 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3393 | nStatus = dot11f_get_packed_measurement_report_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3394 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3395 | 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] | 3396 | nStatus); |
| 3397 | /* We'll fall back on the worst case scenario: */ |
| 3398 | nPayload = sizeof(tDot11fMeasurementReport); |
| 3399 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3400 | pe_warn("There were warnings while calculating the packed size for a Measurement Report (0x%08x)", |
| 3401 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3402 | } |
| 3403 | |
| 3404 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3405 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3406 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3407 | cds_packet_alloc(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3408 | (uint16_t) nBytes, (void **)&pFrame, |
| 3409 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3410 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 0711e27 | 2018-12-14 23:16:38 -0800 | [diff] [blame] | 3411 | pe_err("Failed to allocate %d bytes for a De-Authentication", |
| 3412 | nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3413 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3414 | } |
| 3415 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3416 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3417 | |
| 3418 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3419 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3420 | SIR_MAC_MGMT_ACTION, peer); |
| 3421 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3422 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3423 | qdf_mem_copy(pMacHdr->bssId, pe_session->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3424 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3425 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3426 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3427 | nStatus = dot11f_pack_measurement_report(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3428 | sizeof(tSirMacMgmtHdr), |
| 3429 | nPayload, &nPayload); |
| 3430 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3431 | pe_err("Failed to pack a Measurement Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3432 | nStatus); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3433 | cds_packet_free(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3434 | (void *)pFrame, (void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3435 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3436 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3437 | pe_warn("There were warnings while packing a Measurement Report (0x%08x)", |
| 3438 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3439 | } |
| 3440 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3441 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3442 | ((pe_session) ? pe_session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3443 | peSessionId : NO_SESSION), pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3444 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3445 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3446 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3447 | lim_tx_complete, pFrame, 0, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3448 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3449 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3450 | ((pe_session) ? pe_session->peSessionId : NO_SESSION), |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3451 | qdf_status)); |
| 3452 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3453 | pe_err("Failed to send a Measurement Report (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3454 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3455 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3456 | return QDF_STATUS_E_FAILURE; /* just allocated... */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3457 | } |
| 3458 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3459 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3460 | |
| 3461 | } /* End lim_send_meas_report_frame. */ |
| 3462 | |
| 3463 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3464 | * \brief Send a TPC Report Action frame |
| 3465 | * |
| 3466 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3467 | * \param mac Pointer to the global MAC datastructure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3468 | * |
| 3469 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 3470 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3471 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3472 | * |
| 3473 | * |
| 3474 | */ |
| 3475 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3476 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3477 | lim_send_tpc_report_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3478 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3479 | tSirMacAddr peer, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3480 | { |
| 3481 | tDot11fTPCReport frm; |
| 3482 | uint8_t *pFrame; |
| 3483 | tpSirMacMgmtHdr pMacHdr; |
| 3484 | uint32_t nBytes, nPayload, nStatus; |
| 3485 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3486 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3487 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3488 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3489 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 3490 | frm.Category.category = ACTION_CATEGORY_SPECTRUM_MGMT; |
Srinivas Girigowda | f8e5d2e | 2019-05-28 11:49:29 -0700 | [diff] [blame] | 3491 | frm.Action.action = ACTION_SPCT_TPC_RPRT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3492 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 3493 | |
| 3494 | frm.TPCReport.tx_power = 0; |
| 3495 | frm.TPCReport.link_margin = 0; |
| 3496 | frm.TPCReport.present = 1; |
| 3497 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3498 | nStatus = dot11f_get_packed_tpc_report_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3499 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3500 | 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] | 3501 | /* We'll fall back on the worst case scenario: */ |
| 3502 | nPayload = sizeof(tDot11fTPCReport); |
| 3503 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3504 | pe_warn("There were warnings while calculating the packed size for a TPC Report (0x%08x)", |
| 3505 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3506 | } |
| 3507 | |
| 3508 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3509 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3510 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3511 | cds_packet_alloc(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3512 | (uint16_t) nBytes, (void **)&pFrame, |
| 3513 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3514 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3515 | pe_err("Failed to allocate %d bytes for a TPC" |
| 3516 | " Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3517 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3518 | } |
| 3519 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3520 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3521 | |
| 3522 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3523 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3524 | SIR_MAC_MGMT_ACTION, peer); |
| 3525 | |
| 3526 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3527 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3528 | qdf_mem_copy(pMacHdr->bssId, pe_session->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3529 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3530 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3531 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3532 | nStatus = dot11f_pack_tpc_report(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3533 | sizeof(tSirMacMgmtHdr), |
| 3534 | nPayload, &nPayload); |
| 3535 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3536 | pe_err("Failed to pack a TPC Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3537 | nStatus); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3538 | cds_packet_free(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3539 | (void *)pFrame, (void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3540 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3541 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3542 | pe_warn("There were warnings while packing a TPC Report (0x%08x)", |
| 3543 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3544 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3545 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3546 | ((pe_session) ? pe_session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3547 | peSessionId : NO_SESSION), pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3548 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3549 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3550 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3551 | lim_tx_complete, pFrame, 0, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3552 | MTRACE(qdf_trace |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3553 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3554 | ((pe_session) ? pe_session->peSessionId : NO_SESSION), |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3555 | qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3556 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3557 | pe_err("Failed to send a TPC Report (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3558 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3559 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3560 | return QDF_STATUS_E_FAILURE; /* just allocated... */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3561 | } |
| 3562 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3563 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3564 | |
| 3565 | } /* End lim_send_tpc_report_frame. */ |
| 3566 | #endif /* ANI_SUPPORT_11H */ |
| 3567 | |
| 3568 | /** |
| 3569 | * \brief Send a Channel Switch Announcement |
| 3570 | * |
| 3571 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3572 | * \param mac Pointer to the global MAC datastructure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3573 | * |
| 3574 | * \param peer MAC address to which this frame will be sent |
| 3575 | * |
| 3576 | * \param nMode |
| 3577 | * |
| 3578 | * \param nNewChannel |
| 3579 | * |
| 3580 | * \param nCount |
| 3581 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3582 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3583 | * |
| 3584 | * |
| 3585 | */ |
| 3586 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3587 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3588 | lim_send_channel_switch_mgmt_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3589 | tSirMacAddr peer, |
| 3590 | uint8_t nMode, |
| 3591 | uint8_t nNewChannel, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3592 | uint8_t nCount, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3593 | { |
| 3594 | tDot11fChannelSwitch frm; |
| 3595 | uint8_t *pFrame; |
| 3596 | tpSirMacMgmtHdr pMacHdr; |
| 3597 | uint32_t nBytes, nPayload, nStatus; /* , nCfg; */ |
| 3598 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3599 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3600 | uint8_t txFlag = 0; |
| 3601 | |
| 3602 | uint8_t smeSessionId = 0; |
| 3603 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3604 | if (!pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3605 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3606 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3607 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3608 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3609 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3610 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3611 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 3612 | frm.Category.category = ACTION_CATEGORY_SPECTRUM_MGMT; |
Srinivas Girigowda | f8e5d2e | 2019-05-28 11:49:29 -0700 | [diff] [blame] | 3613 | frm.Action.action = ACTION_SPCT_CHL_SWITCH; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3614 | frm.ChanSwitchAnn.switchMode = nMode; |
| 3615 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 3616 | frm.ChanSwitchAnn.switchCount = nCount; |
| 3617 | frm.ChanSwitchAnn.present = 1; |
| 3618 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3619 | nStatus = dot11f_get_packed_channel_switch_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3620 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3621 | 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] | 3622 | nStatus); |
| 3623 | /* We'll fall back on the worst case scenario: */ |
| 3624 | nPayload = sizeof(tDot11fChannelSwitch); |
| 3625 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3626 | pe_warn("There were warnings while calculating the packed size for a Channel Switch (0x%08x)", |
| 3627 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3628 | } |
| 3629 | |
| 3630 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3631 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3632 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3633 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 3634 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3635 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3636 | pe_err("Failed to allocate %d bytes for a TPC Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3637 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3638 | } |
| 3639 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3640 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3641 | |
| 3642 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3643 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3644 | SIR_MAC_MGMT_ACTION, peer, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3645 | pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3646 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3647 | qdf_mem_copy((uint8_t *) pMacHdr->bssId, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3648 | (uint8_t *) pe_session->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3649 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3650 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3651 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3652 | nStatus = dot11f_pack_channel_switch(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3653 | sizeof(tSirMacMgmtHdr), |
| 3654 | nPayload, &nPayload); |
| 3655 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3656 | pe_err("Failed to pack a Channel Switch (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3657 | nStatus); |
| 3658 | cds_packet_free((void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3659 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3660 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3661 | pe_warn("There were warnings while packing a Channel Switch (0x%08x)", |
| 3662 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3663 | } |
| 3664 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3665 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) || |
| 3666 | (pe_session->opmode == QDF_P2P_CLIENT_MODE) || |
| 3667 | (pe_session->opmode == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3668 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3669 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3670 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3671 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3672 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3673 | TXRX_FRM_802_11_MGMT, |
| 3674 | ANI_TXDIR_TODS, |
| 3675 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3676 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3677 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3678 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3679 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3680 | pe_err("Failed to send a Channel Switch (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3681 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3682 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3683 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3684 | } |
| 3685 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3686 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3687 | |
| 3688 | } /* End lim_send_channel_switch_mgmt_frame. */ |
| 3689 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3690 | /** |
| 3691 | * lim_send_extended_chan_switch_action_frame()- function to send ECSA |
| 3692 | * action frame over the air . |
| 3693 | * @mac_ctx: pointer to global mac structure |
| 3694 | * @peer: Destination mac. |
| 3695 | * @mode: channel switch mode |
| 3696 | * @new_op_class: new op class |
| 3697 | * @new_channel: new channel to switch |
| 3698 | * @count: channel switch count |
| 3699 | * |
| 3700 | * This function is called to send ECSA frame. |
| 3701 | * |
| 3702 | * Return: success if frame is sent else return failure |
| 3703 | */ |
| 3704 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3705 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3706 | lim_send_extended_chan_switch_action_frame(struct mac_context *mac_ctx, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3707 | tSirMacAddr peer, uint8_t mode, uint8_t new_op_class, |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 3708 | uint8_t new_channel, uint8_t count, struct pe_session *session_entry) |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3709 | { |
| 3710 | tDot11fext_channel_switch_action_frame frm; |
| 3711 | uint8_t *frame; |
| 3712 | tpSirMacMgmtHdr mac_hdr; |
| 3713 | uint32_t num_bytes, n_payload, status; |
| 3714 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3715 | QDF_STATUS qdf_status; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3716 | uint8_t txFlag = 0; |
| 3717 | uint8_t sme_session_id = 0; |
Vignesh Viswanathan | 93b7f70 | 2017-12-19 17:48:45 +0530 | [diff] [blame] | 3718 | uint8_t ch_spacing; |
| 3719 | tLimWiderBWChannelSwitchInfo *wide_bw_ie; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3720 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3721 | if (!session_entry) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3722 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3723 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3724 | } |
| 3725 | |
| 3726 | sme_session_id = session_entry->smeSessionId; |
| 3727 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3728 | qdf_mem_zero(&frm, sizeof(frm)); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3729 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 3730 | frm.Category.category = ACTION_CATEGORY_PUBLIC; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3731 | frm.Action.action = SIR_MAC_ACTION_EXT_CHANNEL_SWITCH_ID; |
| 3732 | |
| 3733 | frm.ext_chan_switch_ann_action.switch_mode = mode; |
| 3734 | frm.ext_chan_switch_ann_action.op_class = new_op_class; |
| 3735 | frm.ext_chan_switch_ann_action.new_channel = new_channel; |
| 3736 | frm.ext_chan_switch_ann_action.switch_count = count; |
| 3737 | |
Vignesh Viswanathan | 93b7f70 | 2017-12-19 17:48:45 +0530 | [diff] [blame] | 3738 | ch_spacing = wlan_reg_dmn_get_chanwidth_from_opclass( |
| 3739 | mac_ctx->scan.countryCodeCurrent, new_channel, |
| 3740 | new_op_class); |
| 3741 | pe_debug("wrapper: ch_spacing %hu", ch_spacing); |
| 3742 | |
| 3743 | if ((ch_spacing == 80) || (ch_spacing == 160)) { |
| 3744 | wide_bw_ie = &session_entry->gLimWiderBWChannelSwitch; |
| 3745 | frm.WiderBWChanSwitchAnn.newChanWidth = |
| 3746 | wide_bw_ie->newChanWidth; |
| 3747 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = |
| 3748 | wide_bw_ie->newCenterChanFreq0; |
| 3749 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = |
| 3750 | wide_bw_ie->newCenterChanFreq1; |
| 3751 | frm.WiderBWChanSwitchAnn.present = 1; |
| 3752 | pe_debug("wrapper: width:%d f0:%d f1:%d", |
| 3753 | frm.WiderBWChanSwitchAnn.newChanWidth, |
| 3754 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0, |
| 3755 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1); |
| 3756 | } |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3757 | |
| 3758 | status = dot11f_get_packed_ext_channel_switch_action_frame_size(mac_ctx, |
| 3759 | &frm, &n_payload); |
| 3760 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3761 | pe_err("Failed to get packed size for Channel Switch 0x%08x", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3762 | status); |
| 3763 | /* We'll fall back on the worst case scenario*/ |
| 3764 | n_payload = sizeof(tDot11fext_channel_switch_action_frame); |
| 3765 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3766 | 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] | 3767 | status); |
| 3768 | } |
| 3769 | |
| 3770 | num_bytes = n_payload + sizeof(tSirMacMgmtHdr); |
| 3771 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3772 | qdf_status = cds_packet_alloc((uint16_t)num_bytes, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3773 | (void **) &frame, (void **) &packet); |
| 3774 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3775 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3776 | pe_err("Failed to allocate %d bytes for a Ext Channel Switch", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3777 | num_bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3778 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3779 | } |
| 3780 | |
| 3781 | /* Paranoia*/ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3782 | qdf_mem_zero(frame, num_bytes); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3783 | |
| 3784 | /* Next, we fill out the buffer descriptor */ |
| 3785 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3786 | SIR_MAC_MGMT_ACTION, peer, session_entry->self_mac_addr); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3787 | mac_hdr = (tpSirMacMgmtHdr) frame; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3788 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3789 | (uint8_t *) session_entry->bssId, |
| 3790 | sizeof(tSirMacAddr)); |
| 3791 | |
gaolez | 4b62a9e | 2018-08-16 15:57:50 +0800 | [diff] [blame] | 3792 | lim_set_protected_bit(mac_ctx, session_entry, peer, mac_hdr); |
| 3793 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3794 | status = dot11f_pack_ext_channel_switch_action_frame(mac_ctx, &frm, |
| 3795 | frame + sizeof(tSirMacMgmtHdr), n_payload, &n_payload); |
| 3796 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3797 | pe_err("Failed to pack a Channel Switch 0x%08x", status); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3798 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3799 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3800 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3801 | pe_warn("There were warnings while packing a Channel Switch 0x%08x", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3802 | status); |
| 3803 | } |
| 3804 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3805 | if ((BAND_5G == lim_get_rf_band(session_entry->currentOperChannel)) || |
| 3806 | (session_entry->opmode == QDF_P2P_CLIENT_MODE) || |
| 3807 | (session_entry->opmode == QDF_P2P_GO_MODE)) |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3808 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3809 | |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3810 | 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] | 3811 | QDF_MAC_ADDR_ARRAY(mac_hdr->da), |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3812 | frm.ext_chan_switch_ann_action.switch_count, |
| 3813 | frm.ext_chan_switch_ann_action.switch_mode, |
| 3814 | frm.ext_chan_switch_ann_action.new_channel, |
| 3815 | frm.ext_chan_switch_ann_action.op_class); |
| 3816 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3817 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3818 | session_entry->peSessionId, mac_hdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3819 | qdf_status = wma_tx_frame(mac_ctx, packet, (uint16_t) num_bytes, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3820 | TXRX_FRM_802_11_MGMT, |
| 3821 | ANI_TXDIR_TODS, |
| 3822 | 7, |
| 3823 | lim_tx_complete, frame, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3824 | txFlag, sme_session_id, 0, |
| 3825 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3826 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3827 | session_entry->peSessionId, qdf_status)); |
| 3828 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3829 | pe_err("Failed to send a Ext Channel Switch %X!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3830 | qdf_status); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3831 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3832 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3833 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3834 | return QDF_STATUS_SUCCESS; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3835 | } /* End lim_send_extended_chan_switch_action_frame */ |
| 3836 | |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3837 | |
| 3838 | /** |
| 3839 | * lim_oper_chan_change_confirm_tx_complete_cnf()- Confirmation for oper_chan_change_confirm |
| 3840 | * sent over the air |
| 3841 | * |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3842 | * @context: pointer to global mac |
| 3843 | * @buf: buffer |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3844 | * @tx_complete : Sent status |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3845 | * @params: tx completion params |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3846 | * |
| 3847 | * Return: This returns QDF_STATUS |
| 3848 | */ |
| 3849 | |
| 3850 | static QDF_STATUS lim_oper_chan_change_confirm_tx_complete_cnf( |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3851 | void *context, |
| 3852 | qdf_nbuf_t buf, |
| 3853 | uint32_t tx_complete, |
| 3854 | void *params) |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3855 | { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3856 | pe_debug("tx_complete: %d", tx_complete); |
Zhu Jianmin | 83e8b12 | 2018-05-18 19:24:45 +0800 | [diff] [blame] | 3857 | if (buf) |
| 3858 | qdf_nbuf_free(buf); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3859 | return QDF_STATUS_SUCCESS; |
| 3860 | } |
| 3861 | |
| 3862 | /** |
| 3863 | * lim_p2p_oper_chan_change_confirm_action_frame()- function to send |
| 3864 | * p2p oper chan change confirm action frame |
| 3865 | * @mac_ctx: pointer to global mac structure |
| 3866 | * @peer: Destination mac. |
| 3867 | * @session_entry: session entry |
| 3868 | * |
| 3869 | * This function is called to send p2p oper chan change confirm action frame. |
| 3870 | * |
| 3871 | * Return: success if frame is sent else return failure |
| 3872 | */ |
| 3873 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3874 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3875 | 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] | 3876 | tSirMacAddr peer, struct pe_session *session_entry) |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3877 | { |
| 3878 | tDot11fp2p_oper_chan_change_confirm frm; |
| 3879 | uint8_t *frame; |
| 3880 | tpSirMacMgmtHdr mac_hdr; |
| 3881 | uint32_t num_bytes, n_payload, status; |
| 3882 | void *packet; |
| 3883 | QDF_STATUS qdf_status; |
| 3884 | uint8_t tx_flag = 0; |
| 3885 | uint8_t sme_session_id = 0; |
| 3886 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3887 | if (!session_entry) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3888 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3889 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3890 | } |
| 3891 | |
| 3892 | sme_session_id = session_entry->smeSessionId; |
| 3893 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3894 | qdf_mem_zero(&frm, sizeof(frm)); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3895 | |
| 3896 | frm.Category.category = SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY; |
| 3897 | |
| 3898 | qdf_mem_copy(frm.p2p_action_oui.oui_data, |
| 3899 | SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE); |
| 3900 | frm.p2p_action_subtype.subtype = 0x04; |
| 3901 | frm.DialogToken.token = 0x0; |
| 3902 | |
| 3903 | if (session_entry->htCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3904 | pe_debug("Populate HT Caps in Assoc Request"); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3905 | populate_dot11f_ht_caps(mac_ctx, session_entry, &frm.HTCaps); |
| 3906 | } |
| 3907 | |
| 3908 | if (session_entry->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3909 | pe_debug("Populate VHT Caps in Assoc Request"); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3910 | populate_dot11f_vht_caps(mac_ctx, session_entry, &frm.VHTCaps); |
| 3911 | populate_dot11f_operating_mode(mac_ctx, |
| 3912 | &frm.OperatingMode, session_entry); |
| 3913 | } |
| 3914 | |
| 3915 | status = dot11f_get_packed_p2p_oper_chan_change_confirmSize(mac_ctx, |
| 3916 | &frm, &n_payload); |
| 3917 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3918 | pe_err("Failed to get packed size 0x%08x", status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3919 | /* We'll fall back on the worst case scenario*/ |
| 3920 | n_payload = sizeof(tDot11fp2p_oper_chan_change_confirm); |
| 3921 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3922 | pe_warn("There were warnings while calculating the packed size (0x%08x)", |
| 3923 | status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3924 | } |
| 3925 | |
| 3926 | num_bytes = n_payload + sizeof(tSirMacMgmtHdr); |
| 3927 | |
| 3928 | qdf_status = cds_packet_alloc((uint16_t)num_bytes, |
| 3929 | (void **) &frame, (void **) &packet); |
| 3930 | |
| 3931 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3932 | pe_err("Failed to allocate %d bytes", num_bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3933 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3934 | } |
| 3935 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3936 | qdf_mem_zero(frame, num_bytes); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3937 | |
| 3938 | /* Next, fill out the buffer descriptor */ |
| 3939 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3940 | SIR_MAC_MGMT_ACTION, peer, session_entry->self_mac_addr); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3941 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 3942 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
| 3943 | (uint8_t *) session_entry->bssId, |
| 3944 | sizeof(tSirMacAddr)); |
| 3945 | |
| 3946 | status = dot11f_pack_p2p_oper_chan_change_confirm(mac_ctx, &frm, |
| 3947 | frame + sizeof(tSirMacMgmtHdr), n_payload, &n_payload); |
| 3948 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3949 | pe_err("Failed to pack 0x%08x", status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3950 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3951 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3952 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3953 | pe_warn("There were warnings while packing 0x%08x", |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3954 | status); |
| 3955 | } |
| 3956 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 3957 | if ((BAND_5G == |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3958 | lim_get_rf_band(session_entry->currentOperChannel)) || |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3959 | (session_entry->opmode == QDF_P2P_CLIENT_MODE) || |
| 3960 | (session_entry->opmode == QDF_P2P_GO_MODE)) { |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3961 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3962 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3963 | pe_debug("Send frame on channel %d to mac " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3964 | QDF_MAC_ADDR_STR, session_entry->currentOperChannel, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3965 | QDF_MAC_ADDR_ARRAY(peer)); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3966 | |
| 3967 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
| 3968 | session_entry->peSessionId, mac_hdr->fc.subType)); |
| 3969 | |
| 3970 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 3971 | (uint16_t)num_bytes, |
| 3972 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3973 | 7, lim_tx_complete, frame, |
| 3974 | lim_oper_chan_change_confirm_tx_complete_cnf, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3975 | tx_flag, sme_session_id, false, 0, RATEID_DEFAULT); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3976 | |
| 3977 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 3978 | session_entry->peSessionId, qdf_status)); |
| 3979 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3980 | pe_err("Failed to send status %X!", qdf_status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3981 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3982 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3983 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3984 | return QDF_STATUS_SUCCESS; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3985 | } |
| 3986 | |
| 3987 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3988 | /** |
| 3989 | * \brief Send a Neighbor Report Request Action frame |
| 3990 | * |
| 3991 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3992 | * \param mac Pointer to the global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3993 | * |
| 3994 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 3995 | * |
| 3996 | * \param peer mac address of peer station. |
| 3997 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3998 | * \param pe_session address of session entry. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3999 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4000 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4001 | * |
| 4002 | * |
| 4003 | */ |
| 4004 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4005 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4006 | lim_send_neighbor_report_request_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4007 | tpSirMacNeighborReportReq pNeighborReq, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4008 | tSirMacAddr peer, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4009 | { |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4010 | QDF_STATUS status_code = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4011 | tDot11fNeighborReportRequest frm; |
| 4012 | uint8_t *pFrame; |
| 4013 | tpSirMacMgmtHdr pMacHdr; |
| 4014 | uint32_t nBytes, nPayload, nStatus; |
| 4015 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4016 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4017 | uint8_t txFlag = 0; |
| 4018 | uint8_t smeSessionId = 0; |
| 4019 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4020 | if (!pe_session) { |
| 4021 | pe_err("(!psession) in Request to send Neighbor Report request action frame"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4022 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4023 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4024 | smeSessionId = pe_session->smeSessionId; |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4025 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4026 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4027 | frm.Category.category = ACTION_CATEGORY_RRM; |
Srinivas Girigowda | 395addd | 2019-05-24 14:03:58 -0700 | [diff] [blame] | 4028 | frm.Action.action = RRM_NEIGHBOR_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4029 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 4030 | |
| 4031 | if (pNeighborReq->ssid_present) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4032 | populate_dot11f_ssid(mac, &pNeighborReq->ssid, &frm.SSID); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4033 | } |
| 4034 | |
| 4035 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4036 | dot11f_get_packed_neighbor_report_request_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4037 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4038 | 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] | 4039 | nStatus); |
| 4040 | /* We'll fall back on the worst case scenario: */ |
| 4041 | nPayload = sizeof(tDot11fNeighborReportRequest); |
| 4042 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4043 | pe_warn("There were warnings while calculating the packed size for a Neighbor Report Request(0x%08x)", |
| 4044 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4045 | } |
| 4046 | |
| 4047 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4048 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4049 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4050 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4051 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4052 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4053 | pe_err("Failed to allocate %d bytes for a Neighbor " |
| 4054 | "Report Request", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4055 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4056 | } |
| 4057 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4058 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4059 | |
| 4060 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4061 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4062 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4063 | |
| 4064 | /* Update A3 with the BSSID */ |
| 4065 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4066 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4067 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4068 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4069 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4070 | |
| 4071 | /* Now, we're ready to "pack" the frames */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4072 | nStatus = dot11f_pack_neighbor_report_request(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4073 | &frm, |
| 4074 | pFrame + |
| 4075 | sizeof(tSirMacMgmtHdr), |
| 4076 | nPayload, &nPayload); |
| 4077 | |
| 4078 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4079 | pe_err("Failed to pack an Neighbor Report Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4080 | nStatus); |
| 4081 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4082 | /* FIXME - Need to convert to QDF_STATUS */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4083 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4084 | goto returnAfterError; |
| 4085 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4086 | pe_warn("There were warnings while packing Neighbor Report Request (0x%08x)", |
| 4087 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4088 | } |
| 4089 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4090 | pe_debug("Sending a Neighbor Report Request to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4091 | lim_print_mac_addr(mac, peer, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4092 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 4093 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) || |
| 4094 | (pe_session->opmode == QDF_P2P_CLIENT_MODE) || |
| 4095 | (pe_session->opmode == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4096 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4097 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4098 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4099 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4100 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4101 | pPacket, |
| 4102 | (uint16_t) nBytes, |
| 4103 | TXRX_FRM_802_11_MGMT, |
| 4104 | ANI_TXDIR_TODS, |
| 4105 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4106 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4107 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4108 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4109 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4110 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4111 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4112 | /* Pkt will be freed up by the callback */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4113 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4114 | } else |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4115 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4116 | |
| 4117 | returnAfterError: |
| 4118 | cds_packet_free((void *)pPacket); |
| 4119 | |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4120 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4121 | } /* End lim_send_neighbor_report_request_frame. */ |
| 4122 | |
| 4123 | /** |
| 4124 | * \brief Send a Link Report Action frame |
| 4125 | * |
| 4126 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4127 | * \param mac Pointer to the global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4128 | * |
| 4129 | * \param pLinkReport Address of a tSirMacLinkReport |
| 4130 | * |
| 4131 | * \param peer mac address of peer station. |
| 4132 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4133 | * \param pe_session address of session entry. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4134 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4135 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4136 | * |
| 4137 | * |
| 4138 | */ |
| 4139 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4140 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4141 | lim_send_link_report_action_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4142 | tpSirMacLinkReport pLinkReport, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4143 | tSirMacAddr peer, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4144 | { |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4145 | QDF_STATUS status_code = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4146 | tDot11fLinkMeasurementReport frm; |
| 4147 | uint8_t *pFrame; |
| 4148 | tpSirMacMgmtHdr pMacHdr; |
| 4149 | uint32_t nBytes, nPayload, nStatus; |
| 4150 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4151 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4152 | uint8_t txFlag = 0; |
| 4153 | uint8_t smeSessionId = 0; |
| 4154 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4155 | if (!pe_session) { |
| 4156 | pe_err("(!psession) in Request to send Link Report action frame"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4157 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4158 | } |
| 4159 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4160 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4161 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4162 | frm.Category.category = ACTION_CATEGORY_RRM; |
Srinivas Girigowda | 395addd | 2019-05-24 14:03:58 -0700 | [diff] [blame] | 4163 | frm.Action.action = RRM_LINK_MEASUREMENT_RPT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4164 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 4165 | |
| 4166 | /* IEEE Std. 802.11 7.3.2.18. for the report element. */ |
| 4167 | /* Even though TPC report an IE, it is represented using fixed fields since it is positioned */ |
| 4168 | /* in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 */ |
| 4169 | /* and frame parser always expects IEs to come after all fixed fields. It is easier to handle */ |
| 4170 | /* such case this way than changing the frame parser. */ |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 4171 | frm.TPCEleID.TPCId = WLAN_ELEMID_TPCREP; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4172 | frm.TPCEleLen.TPCLen = 2; |
| 4173 | frm.TxPower.txPower = pLinkReport->txPower; |
| 4174 | frm.LinkMargin.linkMargin = 0; |
| 4175 | |
| 4176 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 4177 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 4178 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 4179 | frm.RSNI.rsni = pLinkReport->rsni; |
| 4180 | |
| 4181 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4182 | dot11f_get_packed_link_measurement_report_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4183 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4184 | 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] | 4185 | /* We'll fall back on the worst case scenario: */ |
| 4186 | nPayload = sizeof(tDot11fLinkMeasurementReport); |
| 4187 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4188 | pe_warn("There were warnings while calculating the packed size for a Link Report (0x%08x)", |
| 4189 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4190 | } |
| 4191 | |
| 4192 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4193 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4194 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4195 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4196 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4197 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4198 | pe_err("Failed to allocate %d bytes for a Link " |
| 4199 | "Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4200 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4201 | } |
| 4202 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4203 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4204 | |
| 4205 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4206 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4207 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4208 | |
| 4209 | /* Update A3 with the BSSID */ |
| 4210 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4211 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4212 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4213 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4214 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4215 | |
| 4216 | /* Now, we're ready to "pack" the frames */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4217 | nStatus = dot11f_pack_link_measurement_report(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4218 | &frm, |
| 4219 | pFrame + |
| 4220 | sizeof(tSirMacMgmtHdr), |
| 4221 | nPayload, &nPayload); |
| 4222 | |
| 4223 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4224 | pe_err("Failed to pack an Link Report (0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4225 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4226 | /* FIXME - Need to convert to QDF_STATUS */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4227 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4228 | goto returnAfterError; |
| 4229 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4230 | pe_warn("There were warnings while packing Link Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4231 | nStatus); |
| 4232 | } |
| 4233 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4234 | pe_warn("Sending a Link Report to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4235 | lim_print_mac_addr(mac, peer, LOGW); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4236 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 4237 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) || |
| 4238 | (pe_session->opmode == QDF_P2P_CLIENT_MODE) || |
| 4239 | (pe_session->opmode == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4240 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4241 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4242 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4243 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4244 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4245 | pPacket, |
| 4246 | (uint16_t) nBytes, |
| 4247 | TXRX_FRM_802_11_MGMT, |
| 4248 | ANI_TXDIR_TODS, |
| 4249 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4250 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4251 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4252 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4253 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4254 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4255 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4256 | /* Pkt will be freed up by the callback */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4257 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4258 | } else |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4259 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4260 | |
| 4261 | returnAfterError: |
| 4262 | cds_packet_free((void *)pPacket); |
| 4263 | |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4264 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4265 | } /* End lim_send_link_report_action_frame. */ |
| 4266 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4267 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4268 | lim_send_radio_measure_report_action_frame(struct mac_context *mac, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4269 | uint8_t dialog_token, |
| 4270 | uint8_t num_report, |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 4271 | bool is_last_frame, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4272 | tpSirMacRadioMeasureReport pRRMReport, |
| 4273 | tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4274 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4275 | { |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4276 | QDF_STATUS status_code = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4277 | uint8_t *pFrame; |
| 4278 | tpSirMacMgmtHdr pMacHdr; |
| 4279 | uint32_t nBytes, nPayload, nStatus; |
| 4280 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4281 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4282 | uint8_t i; |
| 4283 | uint8_t txFlag = 0; |
| 4284 | uint8_t smeSessionId = 0; |
Vignesh Viswanathan | 793328d | 2018-11-02 11:32:35 +0530 | [diff] [blame] | 4285 | bool is_last_report = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4286 | |
| 4287 | tDot11fRadioMeasurementReport *frm = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4288 | qdf_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 4289 | if (!frm) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4290 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4291 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4292 | if (!pe_session) { |
| 4293 | pe_err("(!psession) in Request to send Beacon Report action frame"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4294 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4295 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4296 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4297 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4298 | smeSessionId = pe_session->smeSessionId; |
Deepak Dhamdhere | 6a02148 | 2017-04-20 17:59:58 -0700 | [diff] [blame] | 4299 | |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 4300 | pe_debug("dialog_token %d num_report %d is_last_frame %d", |
| 4301 | dialog_token, num_report, is_last_frame); |
Padma, Santhosh Kumar | 93ec7d2 | 2016-12-26 15:58:37 +0530 | [diff] [blame] | 4302 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4303 | frm->Category.category = ACTION_CATEGORY_RRM; |
Srinivas Girigowda | 395addd | 2019-05-24 14:03:58 -0700 | [diff] [blame] | 4304 | frm->Action.action = RRM_RADIO_MEASURE_RPT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4305 | frm->DialogToken.token = dialog_token; |
| 4306 | |
| 4307 | frm->num_MeasurementReport = |
| 4308 | (num_report > |
| 4309 | RADIO_REPORTS_MAX_IN_A_FRAME) ? RADIO_REPORTS_MAX_IN_A_FRAME : |
| 4310 | num_report; |
| 4311 | |
| 4312 | for (i = 0; i < frm->num_MeasurementReport; i++) { |
| 4313 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 4314 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 4315 | frm->MeasurementReport[i].late = 0; /* IEEE 802.11k section 7.3.22. (always zero in rrm) */ |
| 4316 | switch (pRRMReport[i].type) { |
| 4317 | case SIR_MAC_RRM_BEACON_TYPE: |
Vignesh Viswanathan | 793328d | 2018-11-02 11:32:35 +0530 | [diff] [blame] | 4318 | /* |
| 4319 | * Last beacon report indication needs to be set to 1 |
| 4320 | * only for the last report in the last frame |
| 4321 | */ |
| 4322 | if (is_last_frame && |
| 4323 | (i == (frm->num_MeasurementReport - 1))) |
| 4324 | is_last_report = true; |
| 4325 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4326 | populate_dot11f_beacon_report(mac, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4327 | &frm->MeasurementReport[i], |
| 4328 | &pRRMReport[i].report. |
| 4329 | beaconReport, |
Vignesh Viswanathan | 793328d | 2018-11-02 11:32:35 +0530 | [diff] [blame] | 4330 | is_last_report); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4331 | frm->MeasurementReport[i].incapable = |
| 4332 | pRRMReport[i].incapable; |
| 4333 | frm->MeasurementReport[i].refused = |
| 4334 | pRRMReport[i].refused; |
| 4335 | frm->MeasurementReport[i].present = 1; |
| 4336 | break; |
| 4337 | default: |
| 4338 | frm->MeasurementReport[i].incapable = |
| 4339 | pRRMReport[i].incapable; |
| 4340 | frm->MeasurementReport[i].refused = |
| 4341 | pRRMReport[i].refused; |
| 4342 | frm->MeasurementReport[i].present = 1; |
| 4343 | break; |
| 4344 | } |
| 4345 | } |
| 4346 | |
| 4347 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4348 | dot11f_get_packed_radio_measurement_report_size(mac, frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4349 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4350 | 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] | 4351 | nStatus); |
| 4352 | /* We'll fall back on the worst case scenario: */ |
| 4353 | nPayload = sizeof(tDot11fLinkMeasurementReport); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4354 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4355 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4356 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4357 | pe_warn("There were warnings while calculating the packed size for a Radio Measure Report (0x%08x)", |
| 4358 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4359 | } |
| 4360 | |
| 4361 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4362 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4363 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4364 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4365 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4366 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4367 | pe_err("Failed to allocate %d bytes for a Radio Measure " |
| 4368 | "Report", nBytes); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4369 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4370 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4371 | } |
| 4372 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4373 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4374 | |
| 4375 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4376 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4377 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4378 | |
| 4379 | /* Update A3 with the BSSID */ |
| 4380 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4381 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4382 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4383 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4384 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4385 | |
| 4386 | /* Now, we're ready to "pack" the frames */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4387 | nStatus = dot11f_pack_radio_measurement_report(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4388 | frm, |
| 4389 | pFrame + |
| 4390 | sizeof(tSirMacMgmtHdr), |
| 4391 | nPayload, &nPayload); |
| 4392 | |
| 4393 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4394 | pe_err("Failed to pack an Radio Measure Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4395 | nStatus); |
| 4396 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4397 | /* FIXME - Need to convert to QDF_STATUS */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4398 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4399 | goto returnAfterError; |
| 4400 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4401 | pe_warn("There were warnings while packing Radio Measure Report (0x%08x)", |
| 4402 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4403 | } |
| 4404 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4405 | pe_warn("Sending a Radio Measure Report to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4406 | lim_print_mac_addr(mac, peer, LOGW); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4407 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 4408 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) || |
| 4409 | (pe_session->opmode == QDF_P2P_CLIENT_MODE) || |
| 4410 | (pe_session->opmode == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4411 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4412 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4413 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4414 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4415 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4416 | pPacket, |
| 4417 | (uint16_t) nBytes, |
| 4418 | TXRX_FRM_802_11_MGMT, |
| 4419 | ANI_TXDIR_TODS, |
| 4420 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4421 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4422 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4423 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4424 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4425 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4426 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4427 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4428 | qdf_mem_free(frm); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4429 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4430 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4431 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4432 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4433 | } |
| 4434 | |
| 4435 | returnAfterError: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4436 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4437 | cds_packet_free((void *)pPacket); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4438 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4439 | } |
| 4440 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4441 | #ifdef WLAN_FEATURE_11W |
| 4442 | /** |
| 4443 | * \brief Send SA query request action frame to peer |
| 4444 | * |
| 4445 | * \sa lim_send_sa_query_request_frame |
| 4446 | * |
| 4447 | * |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4448 | * \param mac The global struct mac_context *object |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4449 | * |
| 4450 | * \param transId Transaction identifier |
| 4451 | * |
| 4452 | * \param peer The Mac address of the station to which this action frame is addressed |
| 4453 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4454 | * \param pe_session The PE session entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4455 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4456 | * \return QDF_STATUS_SUCCESS if setup completes successfully |
| 4457 | * QDF_STATUS_E_FAILURE is some problem is encountered |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4458 | */ |
| 4459 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4460 | 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] | 4461 | tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4462 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4463 | { |
| 4464 | |
| 4465 | tDot11fSaQueryReq frm; /* SA query request action frame */ |
| 4466 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4467 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4468 | tpSirMacMgmtHdr pMacHdr; |
| 4469 | uint32_t nBytes, nPayload, nStatus; |
| 4470 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4471 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4472 | uint8_t txFlag = 0; |
| 4473 | uint8_t smeSessionId = 0; |
| 4474 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4475 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4476 | frm.Category.category = ACTION_CATEGORY_SA_QUERY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4477 | /* 11w action field is : |
| 4478 | action: 0 --> SA Query Request action frame |
| 4479 | action: 1 --> SA Query Response action frame */ |
Srinivas Girigowda | feb23fc | 2019-06-13 11:12:29 -0700 | [diff] [blame] | 4480 | frm.Action.action = SA_QUERY_REQUEST; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4481 | /* 11w SA Query Request transId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4482 | qdf_mem_copy(&frm.TransactionId.transId[0], &transId[0], 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4483 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4484 | nStatus = dot11f_get_packed_sa_query_req_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4485 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4486 | 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] | 4487 | nStatus); |
| 4488 | /* We'll fall back on the worst case scenario: */ |
| 4489 | nPayload = sizeof(tDot11fSaQueryReq); |
| 4490 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4491 | pe_warn("There were warnings while calculating the packed size for an SA Query Request (0x%08x)", |
| 4492 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4493 | } |
| 4494 | |
| 4495 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4496 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4497 | cds_packet_alloc(nBytes, (void **)&pFrame, (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4498 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4499 | pe_err("Failed to allocate %d bytes for a SA Query Request " |
| 4500 | "action frame", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4501 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4502 | } |
| 4503 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4504 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4505 | |
| 4506 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4507 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4508 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4509 | |
| 4510 | /* Update A3 with the BSSID */ |
| 4511 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4512 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4513 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4514 | |
| 4515 | /* Since this is a SA Query Request, set the "protect" (aka WEP) bit */ |
| 4516 | /* in the FC */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4517 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4518 | |
| 4519 | /* Pack 11w SA Query Request frame */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4520 | nStatus = dot11f_pack_sa_query_req(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4521 | &frm, |
| 4522 | pFrame + sizeof(tSirMacMgmtHdr), |
| 4523 | nPayload, &nPayload); |
| 4524 | |
| 4525 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4526 | pe_err("Failed to pack an SA Query Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4527 | nStatus); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4528 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4529 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4530 | goto returnAfterError; |
| 4531 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4532 | pe_warn("There were warnings while packing SA Query Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4533 | nStatus); |
| 4534 | } |
| 4535 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4536 | pe_debug("Sending an SA Query Request to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4537 | lim_print_mac_addr(mac, peer, LOGD); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4538 | pe_debug("Sending an SA Query Request from "); |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4539 | lim_print_mac_addr(mac, pe_session->self_mac_addr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4540 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4541 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4542 | #ifdef WLAN_FEATURE_P2P |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 4543 | || (pe_session->opmode == QDF_P2P_CLIENT_MODE) || |
| 4544 | (pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4545 | #endif |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 4546 | ) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4547 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 4548 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4549 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4550 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4551 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4552 | pPacket, |
| 4553 | (uint16_t) nBytes, |
| 4554 | TXRX_FRM_802_11_MGMT, |
| 4555 | ANI_TXDIR_TODS, |
| 4556 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4557 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4558 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4559 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4560 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4561 | /* Pkt will be freed up by the callback */ |
| 4562 | return nSirStatus; |
| 4563 | } else { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4564 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4565 | } |
| 4566 | |
| 4567 | returnAfterError: |
| 4568 | cds_packet_free((void *)pPacket); |
| 4569 | return nSirStatus; |
| 4570 | } /* End lim_send_sa_query_request_frame */ |
| 4571 | |
| 4572 | /** |
| 4573 | * \brief Send SA query response action frame to peer |
| 4574 | * |
| 4575 | * \sa lim_send_sa_query_response_frame |
| 4576 | * |
| 4577 | * |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4578 | * \param mac The global struct mac_context *object |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4579 | * |
| 4580 | * \param transId Transaction identifier received in SA query request action frame |
| 4581 | * |
| 4582 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 4583 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4584 | * \param pe_session The PE session entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4585 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4586 | * \return QDF_STATUS_SUCCESS if setup completes successfully |
| 4587 | * QDF_STATUS_E_FAILURE is some problem is encountered |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4588 | */ |
| 4589 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4590 | QDF_STATUS lim_send_sa_query_response_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4591 | uint8_t *transId, tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4592 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4593 | { |
| 4594 | |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 4595 | tDot11fSaQueryRsp frm; /* SA query response action frame */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4596 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4597 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4598 | tpSirMacMgmtHdr pMacHdr; |
| 4599 | uint32_t nBytes, nPayload, nStatus; |
| 4600 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4601 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4602 | uint8_t txFlag = 0; |
| 4603 | uint8_t smeSessionId = 0; |
| 4604 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4605 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4606 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4607 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4608 | frm.Category.category = ACTION_CATEGORY_SA_QUERY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4609 | /*11w action field is : |
| 4610 | action: 0 --> SA query request action frame |
| 4611 | action: 1 --> SA query response action frame */ |
Srinivas Girigowda | feb23fc | 2019-06-13 11:12:29 -0700 | [diff] [blame] | 4612 | frm.Action.action = SA_QUERY_RESPONSE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4613 | /*11w SA query response transId is same as |
| 4614 | SA query request transId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4615 | qdf_mem_copy(&frm.TransactionId.transId[0], &transId[0], 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4616 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4617 | nStatus = dot11f_get_packed_sa_query_rsp_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4618 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4619 | 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] | 4620 | nStatus); |
| 4621 | /* We'll fall back on the worst case scenario: */ |
| 4622 | nPayload = sizeof(tDot11fSaQueryRsp); |
| 4623 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4624 | pe_warn("There were warnings while calculating the packed size for an SA Query Response (0x%08x)", |
| 4625 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4626 | } |
| 4627 | |
| 4628 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4629 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4630 | cds_packet_alloc(nBytes, (void **)&pFrame, (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4631 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4632 | pe_err("Failed to allocate %d bytes for a SA query response" |
| 4633 | " action frame", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4634 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4635 | } |
| 4636 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4637 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4638 | |
| 4639 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4640 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4641 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4642 | |
| 4643 | /* Update A3 with the BSSID */ |
| 4644 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4645 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4646 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4647 | |
| 4648 | /* Since this is a SA Query Response, set the "protect" (aka WEP) bit */ |
| 4649 | /* in the FC */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4650 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4651 | |
| 4652 | /* Pack 11w SA query response frame */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4653 | nStatus = dot11f_pack_sa_query_rsp(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4654 | &frm, |
| 4655 | pFrame + sizeof(tSirMacMgmtHdr), |
| 4656 | nPayload, &nPayload); |
| 4657 | |
| 4658 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4659 | pe_err("Failed to pack an SA Query Response (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4660 | nStatus); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4661 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4662 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4663 | goto returnAfterError; |
| 4664 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4665 | pe_warn("There were warnings while packing SA Query Response (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4666 | nStatus); |
| 4667 | } |
| 4668 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4669 | pe_debug("Sending a SA Query Response to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4670 | lim_print_mac_addr(mac, peer, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4671 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4672 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4673 | #ifdef WLAN_FEATURE_P2P |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 4674 | || (pe_session->opmode == QDF_P2P_CLIENT_MODE) || |
| 4675 | (pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4676 | #endif |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 4677 | ) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4678 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4679 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4680 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4681 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4682 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4683 | pPacket, |
| 4684 | (uint16_t) nBytes, |
| 4685 | TXRX_FRM_802_11_MGMT, |
| 4686 | ANI_TXDIR_TODS, |
| 4687 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4688 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4689 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4690 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4691 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4692 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4693 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4694 | /* Pkt will be freed up by the callback */ |
| 4695 | return nSirStatus; |
| 4696 | } else { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4697 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4698 | } |
| 4699 | |
| 4700 | returnAfterError: |
| 4701 | cds_packet_free((void *)pPacket); |
| 4702 | return nSirStatus; |
| 4703 | } /* End lim_send_sa_query_response_frame */ |
| 4704 | #endif |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4705 | |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4706 | #if defined(QCA_WIFI_QCA6290) || defined(QCA_WIFI_QCA6390) |
| 4707 | #ifdef WLAN_FEATURE_11AX |
| 4708 | #define IS_PE_SESSION_11N_MODE(_session) \ |
| 4709 | ((_session)->htCapability && !(_session)->vhtCapability && \ |
| 4710 | !(_session)->he_capable) |
| 4711 | #else |
| 4712 | #define IS_PE_SESSION_11N_MODE(_session) \ |
| 4713 | ((_session)->htCapability && !(_session)->vhtCapability) |
| 4714 | #endif /* WLAN_FEATURE_11AX */ |
| 4715 | #else |
| 4716 | #define IS_PE_SESSION_11N_MODE(_session) false |
| 4717 | #endif |
| 4718 | |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4719 | /** |
| 4720 | * lim_send_addba_response_frame(): Send ADDBA response action frame to peer |
| 4721 | * @mac_ctx: mac context |
| 4722 | * @peer_mac: Peer MAC address |
| 4723 | * @tid: TID for which addba response is being sent |
| 4724 | * @session: PE session entry |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4725 | * @addba_extn_present: ADDBA extension present flag |
Kiran Kumar Lokere | aee823a | 2018-03-22 15:27:05 -0700 | [diff] [blame] | 4726 | * @amsdu_support: amsdu in ampdu support |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4727 | * |
| 4728 | * This function is called when ADDBA request is successful. ADDBA response is |
| 4729 | * setup by calling addba_response_setup API and frame is then sent out OTA. |
| 4730 | * |
| 4731 | * Return: QDF_STATUS |
| 4732 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4733 | 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] | 4734 | tSirMacAddr peer_mac, uint16_t tid, |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 4735 | struct pe_session *session, uint8_t addba_extn_present, |
Kiran Kumar Lokere | aee823a | 2018-03-22 15:27:05 -0700 | [diff] [blame] | 4736 | uint8_t amsdu_support) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4737 | { |
| 4738 | |
| 4739 | tDot11faddba_rsp frm; |
| 4740 | uint8_t *frame_ptr; |
| 4741 | tpSirMacMgmtHdr mgmt_hdr; |
| 4742 | uint32_t num_bytes, payload_size, status; |
Sandeep Puligilla | 39cec08 | 2018-04-30 15:18:45 -0700 | [diff] [blame] | 4743 | void *pkt_ptr = NULL; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4744 | QDF_STATUS qdf_status; |
| 4745 | uint8_t tx_flag = 0; |
| 4746 | uint8_t sme_sessionid = 0; |
| 4747 | uint16_t buff_size, status_code, batimeout; |
| 4748 | uint8_t peer_id, dialog_token; |
| 4749 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 4750 | void *peer, *pdev; |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4751 | uint8_t he_frag = 0; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4752 | |
| 4753 | sme_sessionid = session->smeSessionId; |
| 4754 | |
| 4755 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 4756 | if (!pdev) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4757 | pe_err("pdev is NULL"); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4758 | return QDF_STATUS_E_FAILURE; |
| 4759 | } |
| 4760 | |
Mohit Khanna | c4c2225 | 2017-11-20 11:06:33 -0800 | [diff] [blame] | 4761 | peer = cdp_peer_get_ref_by_addr(soc, pdev, peer_mac, &peer_id, |
| 4762 | PEER_DEBUG_ID_LIM_SEND_ADDBA_RESP); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4763 | if (!peer) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4764 | pe_err("PEER [%pM] not found", peer_mac); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4765 | return QDF_STATUS_E_FAILURE; |
| 4766 | } |
| 4767 | |
| 4768 | cdp_addba_responsesetup(soc, peer, tid, &dialog_token, |
| 4769 | &status_code, &buff_size, &batimeout); |
| 4770 | |
Mohit Khanna | c4c2225 | 2017-11-20 11:06:33 -0800 | [diff] [blame] | 4771 | cdp_peer_release_ref(soc, peer, PEER_DEBUG_ID_LIM_SEND_ADDBA_RESP); |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4772 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4773 | frm.Category.category = ACTION_CATEGORY_BACK; |
Srinivas Girigowda | ef0d714 | 2019-05-17 17:07:47 -0700 | [diff] [blame] | 4774 | frm.Action.action = ADDBA_RESPONSE; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4775 | |
| 4776 | frm.DialogToken.token = dialog_token; |
| 4777 | frm.Status.status = status_code; |
Kiran Kumar Lokere | 08195ef | 2018-01-17 19:25:15 -0800 | [diff] [blame] | 4778 | if (mac_ctx->reject_addba_req) { |
| 4779 | frm.Status.status = eSIR_MAC_REQ_DECLINED_STATUS; |
| 4780 | pe_err("refused addba req"); |
| 4781 | } |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4782 | frm.addba_param_set.tid = tid; |
Kiran Kumar Lokere | 22f05d4 | 2019-06-28 18:33:43 -0700 | [diff] [blame] | 4783 | if (lim_is_session_he_capable(session)) |
| 4784 | frm.addba_param_set.buff_size = MAX_BA_BUFF_SIZE; |
| 4785 | else |
| 4786 | 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] | 4787 | if (mac_ctx->usr_cfg_ba_buff_size) |
| 4788 | 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] | 4789 | |
| 4790 | if (frm.addba_param_set.buff_size > MAX_BA_BUFF_SIZE) |
| 4791 | frm.addba_param_set.buff_size = MAX_BA_BUFF_SIZE; |
| 4792 | |
| 4793 | if (frm.addba_param_set.buff_size > SIR_MAC_BA_DEFAULT_BUFF_SIZE) { |
| 4794 | if (session->active_ba_64_session) { |
| 4795 | frm.addba_param_set.buff_size = |
| 4796 | SIR_MAC_BA_DEFAULT_BUFF_SIZE; |
| 4797 | } |
| 4798 | } else if (!session->active_ba_64_session) { |
| 4799 | session->active_ba_64_session = true; |
| 4800 | } |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4801 | |
| 4802 | /* disable 11n RX AMSDU */ |
| 4803 | if (mac_ctx->is_usr_cfg_amsdu_enabled && |
| 4804 | !IS_PE_SESSION_11N_MODE(session)) |
Arif Hussain | 0e24680 | 2018-05-01 18:13:44 -0700 | [diff] [blame] | 4805 | frm.addba_param_set.amsdu_supp = amsdu_support; |
| 4806 | else |
| 4807 | frm.addba_param_set.amsdu_supp = 0; |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4808 | |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 4809 | frm.addba_param_set.policy = SIR_MAC_BA_POLICY_IMMEDIATE; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4810 | frm.ba_timeout.timeout = batimeout; |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4811 | if (addba_extn_present) { |
| 4812 | frm.addba_extn_element.present = 1; |
| 4813 | frm.addba_extn_element.no_fragmentation = 1; |
| 4814 | if (lim_is_session_he_capable(session)) { |
| 4815 | he_frag = lim_get_session_he_frag_cap(session); |
| 4816 | if (he_frag != 0) { |
| 4817 | frm.addba_extn_element.no_fragmentation = 0; |
| 4818 | frm.addba_extn_element.he_frag_operation = |
| 4819 | he_frag; |
| 4820 | } |
| 4821 | } |
| 4822 | } |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4823 | |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4824 | pe_debug("Sending a ADDBA Response from %pM to %pM", |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4825 | session->self_mac_addr, peer_mac); |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4826 | 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] | 4827 | tid, frm.DialogToken.token, frm.Status.status, |
| 4828 | frm.addba_param_set.buff_size); |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4829 | pe_debug("addba_extn %d he_capable %d no_frag %d he_frag %d", |
| 4830 | addba_extn_present, |
| 4831 | lim_is_session_he_capable(session), |
| 4832 | frm.addba_extn_element.no_fragmentation, |
| 4833 | frm.addba_extn_element.he_frag_operation); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4834 | |
| 4835 | status = dot11f_get_packed_addba_rsp_size(mac_ctx, &frm, &payload_size); |
| 4836 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4837 | 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] | 4838 | status); |
| 4839 | /* We'll fall back on the worst case scenario: */ |
| 4840 | payload_size = sizeof(tDot11faddba_rsp); |
| 4841 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4842 | 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] | 4843 | } |
| 4844 | |
| 4845 | num_bytes = payload_size + sizeof(*mgmt_hdr); |
| 4846 | qdf_status = cds_packet_alloc(num_bytes, (void **)&frame_ptr, |
| 4847 | (void **)&pkt_ptr); |
Sandeep Puligilla | 39cec08 | 2018-04-30 15:18:45 -0700 | [diff] [blame] | 4848 | if (!QDF_IS_STATUS_SUCCESS(qdf_status) || (!pkt_ptr)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4849 | pe_err("Failed to allocate %d bytes for a ADDBA response action frame", |
| 4850 | num_bytes); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4851 | return QDF_STATUS_E_FAILURE; |
| 4852 | } |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4853 | qdf_mem_zero(frame_ptr, num_bytes); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4854 | |
| 4855 | lim_populate_mac_header(mac_ctx, frame_ptr, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4856 | SIR_MAC_MGMT_ACTION, peer_mac, session->self_mac_addr); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4857 | |
| 4858 | /* Update A3 with the BSSID */ |
| 4859 | mgmt_hdr = (tpSirMacMgmtHdr) frame_ptr; |
| 4860 | sir_copy_mac_addr(mgmt_hdr->bssId, session->bssId); |
| 4861 | |
| 4862 | /* ADDBA Response is a robust mgmt action frame, |
| 4863 | * set the "protect" (aka WEP) bit in the FC |
| 4864 | */ |
| 4865 | lim_set_protected_bit(mac_ctx, session, peer_mac, mgmt_hdr); |
| 4866 | |
| 4867 | status = dot11f_pack_addba_rsp(mac_ctx, &frm, |
| 4868 | frame_ptr + sizeof(tSirMacMgmtHdr), payload_size, |
| 4869 | &payload_size); |
| 4870 | |
| 4871 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4872 | pe_err("Failed to pack a ADDBA Response (0x%08x)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4873 | status); |
| 4874 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4875 | goto error_addba_rsp; |
| 4876 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4877 | pe_warn("There were warnings while packing ADDBA Response (0x%08x)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4878 | status); |
| 4879 | } |
| 4880 | |
| 4881 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4882 | if ((BAND_5G == lim_get_rf_band(session->currentOperChannel)) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4883 | #ifdef WLAN_FEATURE_P2P |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 4884 | || (session->opmode == QDF_P2P_CLIENT_MODE) || |
| 4885 | (session->opmode == QDF_P2P_GO_MODE) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4886 | #endif |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 4887 | ) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4888 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4889 | |
| 4890 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
| 4891 | session->peSessionId, mgmt_hdr->fc.subType)); |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 4892 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, pkt_ptr, |
| 4893 | (uint16_t)num_bytes, |
| 4894 | TXRX_FRM_802_11_MGMT, |
| 4895 | ANI_TXDIR_TODS, 7, |
| 4896 | NULL, frame_ptr, |
| 4897 | lim_addba_rsp_tx_complete_cnf, |
| 4898 | tx_flag, sme_sessionid, |
| 4899 | false, 0, RATEID_DEFAULT); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4900 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 4901 | session->peSessionId, qdf_status)); |
| 4902 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4903 | pe_err("wma_tx_frame FAILED! Status [%d]", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4904 | qdf_status); |
chenguo | 90c6846 | 2019-01-24 18:27:01 +0800 | [diff] [blame] | 4905 | return QDF_STATUS_E_FAILURE; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4906 | } else { |
Tushnim Bhattacharyya | d58e4c9 | 2018-03-27 13:40:12 -0700 | [diff] [blame] | 4907 | return QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4908 | } |
| 4909 | |
| 4910 | error_addba_rsp: |
| 4911 | cds_packet_free((void *)pkt_ptr); |
| 4912 | return qdf_status; |
| 4913 | } |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 4914 | |
| 4915 | /** |
| 4916 | * lim_tx_mgmt_frame() - Transmits Auth mgmt frame |
| 4917 | * @mac_ctx Pointer to Global MAC structure |
| 4918 | * @mb_msg: Received message info |
| 4919 | * @msg_len: Received message length |
| 4920 | * @packet: Packet to be transmitted |
| 4921 | * @frame: Received frame |
| 4922 | * |
| 4923 | * Return: None |
| 4924 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4925 | static void lim_tx_mgmt_frame(struct mac_context *mac_ctx, |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 4926 | struct sir_mgmt_msg *mb_msg, uint32_t msg_len, |
| 4927 | void *packet, uint8_t *frame) |
| 4928 | { |
| 4929 | tpSirMacFrameCtl fc = (tpSirMacFrameCtl) mb_msg->data; |
| 4930 | QDF_STATUS qdf_status; |
| 4931 | uint8_t sme_session_id = 0; |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 4932 | struct pe_session *session; |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 4933 | uint16_t auth_ack_status; |
| 4934 | enum rateid min_rid = RATEID_DEFAULT; |
| 4935 | |
| 4936 | sme_session_id = mb_msg->session_id; |
| 4937 | session = pe_find_session_by_sme_session_id(mac_ctx, sme_session_id); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4938 | if (!session) { |
Wu Gao | 7c0a23f | 2019-03-12 14:16:37 +0800 | [diff] [blame] | 4939 | cds_packet_free((void *)packet); |
| 4940 | pe_err("session not found for given sme session %d", |
| 4941 | sme_session_id); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 4942 | return; |
| 4943 | } |
| 4944 | |
Ashish Kumar Dhanotiya | 9f72df0 | 2018-07-23 19:20:04 +0530 | [diff] [blame] | 4945 | qdf_mtrace(QDF_MODULE_ID_PE, QDF_MODULE_ID_WMA, TRACE_CODE_TX_MGMT, |
| 4946 | session->peSessionId, 0); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 4947 | |
| 4948 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_NOT_RCD; |
| 4949 | min_rid = lim_get_min_session_txrate(session); |
| 4950 | |
| 4951 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 4952 | (uint16_t)msg_len, |
| 4953 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 4954 | 7, lim_tx_complete, frame, |
| 4955 | lim_auth_tx_complete_cnf, |
| 4956 | 0, sme_session_id, false, 0, min_rid); |
| 4957 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 4958 | session->peSessionId, qdf_status)); |
| 4959 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Rachit Kankane | 0baf6e7 | 2018-01-19 15:01:50 +0530 | [diff] [blame] | 4960 | pe_err("*** Could not send Auth frame (subType: %d), retCode=%X ***", |
| 4961 | fc->subType, qdf_status); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 4962 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
| 4963 | auth_ack_status = SENT_FAIL; |
| 4964 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4965 | session, auth_ack_status, QDF_STATUS_E_FAILURE); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 4966 | /* Pkt will be freed up by the callback */ |
| 4967 | } |
| 4968 | } |
| 4969 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4970 | void lim_send_mgmt_frame_tx(struct mac_context *mac_ctx, |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 4971 | struct scheduler_msg *msg) |
| 4972 | { |
| 4973 | struct sir_mgmt_msg *mb_msg = (struct sir_mgmt_msg *)msg->bodyptr; |
| 4974 | uint32_t msg_len; |
| 4975 | tpSirMacFrameCtl fc = (tpSirMacFrameCtl) mb_msg->data; |
| 4976 | uint8_t sme_session_id; |
| 4977 | QDF_STATUS qdf_status; |
| 4978 | uint8_t *frame; |
| 4979 | void *packet; |
Srinivas Dasari | 7621849 | 2019-01-22 15:08:20 +0530 | [diff] [blame] | 4980 | tpSirMacMgmtHdr mac_hdr; |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 4981 | |
| 4982 | msg_len = mb_msg->msg_len - sizeof(*mb_msg); |
| 4983 | pe_debug("sending fc->type: %d fc->subType: %d", |
| 4984 | fc->type, fc->subType); |
| 4985 | |
| 4986 | sme_session_id = mb_msg->session_id; |
Srinivas Dasari | 7621849 | 2019-01-22 15:08:20 +0530 | [diff] [blame] | 4987 | mac_hdr = (tpSirMacMgmtHdr)mb_msg->data; |
| 4988 | |
| 4989 | lim_add_mgmt_seq_num(mac_ctx, mac_hdr); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 4990 | |
| 4991 | qdf_status = cds_packet_alloc((uint16_t) msg_len, (void **)&frame, |
| 4992 | (void **)&packet); |
| 4993 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 4994 | pe_err("call to bufAlloc failed for AUTH frame"); |
| 4995 | return; |
| 4996 | } |
| 4997 | |
| 4998 | qdf_mem_copy(frame, mb_msg->data, msg_len); |
| 4999 | |
| 5000 | lim_tx_mgmt_frame(mac_ctx, mb_msg, msg_len, packet, frame); |
| 5001 | } |