Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Alok Kumar | 2107a96 | 2020-01-13 15:35:29 +0530 | [diff] [blame^] | 2 | * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | /** |
| 20 | * \file lim_send_management_frames.c |
| 21 | * |
| 22 | * \brief Code for preparing and sending 802.11 Management frames |
| 23 | * |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | #include "sir_api.h" |
| 28 | #include "ani_global.h" |
| 29 | #include "sir_mac_prot_def.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 30 | #include "utils_api.h" |
| 31 | #include "lim_types.h" |
| 32 | #include "lim_utils.h" |
| 33 | #include "lim_security_utils.h" |
| 34 | #include "lim_prop_exts_utils.h" |
| 35 | #include "dot11f.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 36 | #include "sch_api.h" |
| 37 | #include "lim_send_messages.h" |
| 38 | #include "lim_assoc_utils.h" |
| 39 | #include "lim_ft.h" |
| 40 | #ifdef WLAN_FEATURE_11W |
| 41 | #include "wni_cfg.h" |
| 42 | #endif |
| 43 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 44 | #include "lim_ft_defs.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 45 | #include "lim_session.h" |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 46 | #include "qdf_types.h" |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 47 | #include "qdf_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 48 | #include "cds_utils.h" |
| 49 | #include "sme_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 50 | #include "rrm_api.h" |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 51 | #include "qdf_crypto.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 52 | |
| 53 | #include "wma_types.h" |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 54 | #include <cdp_txrx_cmn.h> |
Tushnim Bhattacharyya | 45ed04f | 2017-03-15 10:15:05 -0700 | [diff] [blame] | 55 | #include <cdp_txrx_peer_ops.h> |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 56 | #include "lim_process_fils.h" |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 57 | #include "wlan_utility.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * |
| 61 | * \brief This function is called to add the sequence number to the |
| 62 | * management frames |
| 63 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 64 | * \param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 65 | * |
| 66 | * \param pMacHdr Pointer to MAC management header |
| 67 | * |
| 68 | * The pMacHdr argument points to the MAC management header. The |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 69 | * sequence number stored in the mac structure will be incremented |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 70 | * and updated to the MAC management header. The start sequence |
| 71 | * number is WLAN_HOST_SEQ_NUM_MIN and the end value is |
| 72 | * WLAN_HOST_SEQ_NUM_MAX. After reaching the MAX value, the sequence |
| 73 | * number will roll over. |
| 74 | * |
| 75 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 76 | static void lim_add_mgmt_seq_num(struct mac_context *mac, tpSirMacMgmtHdr pMacHdr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 77 | { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 78 | if (mac->mgmtSeqNum >= WLAN_HOST_SEQ_NUM_MAX) { |
| 79 | mac->mgmtSeqNum = WLAN_HOST_SEQ_NUM_MIN - 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 80 | } |
| 81 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 82 | mac->mgmtSeqNum++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 83 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 84 | pMacHdr->seqControl.seqNumLo = (mac->mgmtSeqNum & LOW_SEQ_NUM_MASK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 85 | pMacHdr->seqControl.seqNumHi = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 86 | ((mac->mgmtSeqNum & HIGH_SEQ_NUM_MASK) >> HIGH_SEQ_NUM_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 90 | * lim_populate_mac_header() - Fill in 802.11 header of frame |
| 91 | * |
| 92 | * @mac_ctx: Pointer to Global MAC structure |
| 93 | * @buf: Pointer to the frame buffer that needs to be populate |
| 94 | * @type: 802.11 Type of the frame |
| 95 | * @sub_type: 802.11 Subtype of the frame |
| 96 | * @peer_addr: dst address |
| 97 | * @self_mac_addr: local mac address |
| 98 | * |
| 99 | * This function is called by various LIM modules to prepare the |
| 100 | * 802.11 frame MAC header |
| 101 | * |
| 102 | * The buf argument points to the beginning of the frame buffer to |
| 103 | * which - a) The 802.11 MAC header is set b) Following this MAC header |
| 104 | * will be the MGMT frame payload The payload itself is populated by the |
| 105 | * caller API |
| 106 | * |
| 107 | * Return: None |
| 108 | */ |
| 109 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 110 | void lim_populate_mac_header(struct mac_context *mac_ctx, uint8_t *buf, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 111 | uint8_t type, uint8_t sub_type, tSirMacAddr peer_addr, |
| 112 | tSirMacAddr self_mac_addr) |
| 113 | { |
| 114 | tpSirMacMgmtHdr mac_hdr; |
| 115 | |
| 116 | /* Prepare MAC management header */ |
| 117 | mac_hdr = (tpSirMacMgmtHdr) (buf); |
| 118 | |
| 119 | /* Prepare FC */ |
| 120 | mac_hdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 121 | mac_hdr->fc.type = type; |
| 122 | mac_hdr->fc.subType = sub_type; |
| 123 | |
| 124 | /* Prepare Address 1 */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 125 | qdf_mem_copy((uint8_t *) mac_hdr->da, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 126 | (uint8_t *) peer_addr, sizeof(tSirMacAddr)); |
| 127 | |
| 128 | /* Prepare Address 2 */ |
| 129 | sir_copy_mac_addr(mac_hdr->sa, self_mac_addr); |
| 130 | |
| 131 | /* Prepare Address 3 */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 132 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 133 | (uint8_t *) peer_addr, sizeof(tSirMacAddr)); |
| 134 | |
| 135 | /* Prepare sequence number */ |
| 136 | lim_add_mgmt_seq_num(mac_ctx, mac_hdr); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 137 | pe_debug("seqNumLo=%d, seqNumHi=%d, mgmtSeqNum=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 138 | mac_hdr->seqControl.seqNumLo, |
| 139 | mac_hdr->seqControl.seqNumHi, mac_ctx->mgmtSeqNum); |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * lim_send_probe_req_mgmt_frame() - send probe request management frame |
| 144 | * @mac_ctx: Pointer to Global MAC structure |
| 145 | * @ssid: SSID to be sent in Probe Request frame |
| 146 | * @bssid: BSSID to be sent in Probe Request frame |
| 147 | * @channel: Channel # on which the Probe Request is going out |
| 148 | * @self_macaddr: self MAC address |
| 149 | * @dot11mode: self dotllmode |
| 150 | * @additional_ielen: if non-zero, include additional_ie in the Probe Request |
| 151 | * frame |
| 152 | * @additional_ie: if additional_ielen is non zero, include this field in the |
| 153 | * Probe Request frame |
| 154 | * |
| 155 | * This function is called by various LIM modules to send Probe Request frame |
| 156 | * during active scan/learn phase. |
| 157 | * Probe request is sent out in the following scenarios: |
| 158 | * --heartbeat failure: session needed |
| 159 | * --join req: session needed |
| 160 | * --foreground scan: no session |
| 161 | * --background scan: no session |
| 162 | * --sch_beacon_processing: to get EDCA parameters: session needed |
| 163 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 164 | * Return: QDF_STATUS (QDF_STATUS_SUCCESS on success and error codes otherwise) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 165 | */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 166 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 167 | lim_send_probe_req_mgmt_frame(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 168 | tSirMacSSid *ssid, |
| 169 | tSirMacAddr bssid, |
| 170 | uint8_t channel, |
| 171 | tSirMacAddr self_macaddr, |
| 172 | uint32_t dot11mode, |
Jeff Johnson | 919f2c3 | 2019-01-16 11:22:24 -0800 | [diff] [blame] | 173 | uint16_t *additional_ielen, |
| 174 | uint8_t *additional_ie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 175 | { |
| 176 | tDot11fProbeRequest pr; |
| 177 | uint32_t status, bytes, payload; |
| 178 | uint8_t *frame; |
| 179 | void *packet; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 180 | QDF_STATUS qdf_status; |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 181 | struct pe_session *pesession; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 182 | uint8_t sessionid; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 183 | const uint8_t *p2pie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 184 | uint8_t txflag = 0; |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 185 | uint8_t vdev_id = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 186 | bool is_vht_enabled = false; |
| 187 | uint8_t txPower; |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 188 | uint16_t addn_ielen = 0; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 189 | bool extracted_ext_cap_flag = false; |
| 190 | tDot11fIEExtCap extracted_ext_cap; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 191 | QDF_STATUS sir_status; |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 192 | const uint8_t *qcn_ie = NULL; |
Amruta Kulkarni | 453c4e2 | 2019-11-20 10:59:21 -0800 | [diff] [blame] | 193 | uint32_t chan_freq; |
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) |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 223 | vdev_id = pesession->vdev_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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); |
Manikandan Mohan | 8e4491c | 2019-10-23 16:00:51 -0700 | [diff] [blame] | 319 | populate_dot11f_he_6ghz_cap(mac_ctx, pesession, |
| 320 | &pr.he_6ghz_band_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 321 | |
Sandeep Puligilla | 493fea2 | 2018-04-30 15:31:17 -0700 | [diff] [blame] | 322 | if (addn_ielen && additional_ie) { |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 323 | qdf_mem_zero((uint8_t *)&extracted_ext_cap, |
| 324 | sizeof(tDot11fIEExtCap)); |
| 325 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 326 | additional_ie, |
| 327 | &addn_ielen, |
| 328 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 329 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 330 | pe_debug("Unable to Stripoff ExtCap IE from Probe Req"); |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 331 | } else { |
| 332 | struct s_ext_cap *p_ext_cap = |
| 333 | (struct s_ext_cap *) |
| 334 | extracted_ext_cap.bytes; |
| 335 | if (p_ext_cap->interworking_service) |
| 336 | p_ext_cap->qos_map = 1; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 337 | extracted_ext_cap.num_bytes = |
| 338 | lim_compute_ext_cap_ie_length |
| 339 | (&extracted_ext_cap); |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 340 | extracted_ext_cap_flag = |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 341 | (extracted_ext_cap.num_bytes > 0); |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 342 | if (additional_ielen) |
| 343 | *additional_ielen = addn_ielen; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 344 | } |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 345 | qcn_ie = wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_QCN_OUI_TYPE, |
| 346 | SIR_MAC_QCN_OUI_TYPE_SIZE, |
| 347 | additional_ie, addn_ielen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 348 | } |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 349 | /* Add qcn_ie only if qcn ie is not present in additional_ie */ |
Kiran Kumar Lokere | 89f01f0 | 2019-08-06 18:22:39 -0700 | [diff] [blame] | 350 | if (!qcn_ie) |
| 351 | populate_dot11f_qcn_ie(mac_ctx, &pr.qcn_ie, QCN_IE_ATTR_ID_ALL); |
| 352 | else |
| 353 | populate_dot11f_qcn_ie(mac_ctx, &pr.qcn_ie, |
| 354 | QCN_IE_ATTR_ID_VHT_MCS11); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 355 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 356 | /* |
| 357 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 358 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 359 | * dot11f get packed payload size. |
| 360 | */ |
| 361 | if (extracted_ext_cap_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 362 | lim_merge_extcap_struct(&pr.ExtCap, &extracted_ext_cap, true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 363 | |
| 364 | /* That's it-- now we pack it. First, how much space are we going to */ |
| 365 | status = dot11f_get_packed_probe_request_size(mac_ctx, &pr, &payload); |
| 366 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 367 | 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] | 368 | status); |
| 369 | /* We'll fall back on the worst case scenario: */ |
| 370 | payload = sizeof(tDot11fProbeRequest); |
| 371 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 372 | 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] | 373 | status); |
| 374 | } |
| 375 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 376 | bytes = payload + sizeof(tSirMacMgmtHdr) + addn_ielen; |
| 377 | |
| 378 | /* Ok-- try to allocate some memory: */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 379 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 380 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 381 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 382 | pe_err("Failed to allocate %d bytes for a Probe Request", bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 383 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 384 | } |
| 385 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 386 | qdf_mem_zero(frame, bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 387 | |
| 388 | /* Next, we fill out the buffer descriptor: */ |
| 389 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 390 | SIR_MAC_MGMT_PROBE_REQ, bssid, self_macaddr); |
| 391 | |
| 392 | /* That done, pack the Probe Request: */ |
| 393 | status = dot11f_pack_probe_request(mac_ctx, &pr, frame + |
| 394 | sizeof(tSirMacMgmtHdr), |
| 395 | payload, &payload); |
| 396 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 397 | pe_err("Failed to pack a Probe Request (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 398 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 399 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 400 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 401 | 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] | 402 | } |
| 403 | /* Append any AddIE if present. */ |
| 404 | if (addn_ielen) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 405 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 406 | additional_ie, addn_ielen); |
| 407 | payload += addn_ielen; |
| 408 | } |
| 409 | |
Amruta Kulkarni | 453c4e2 | 2019-11-20 10:59:21 -0800 | [diff] [blame] | 410 | chan_freq = wlan_reg_chan_to_freq(mac_ctx->pdev, channel); |
| 411 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 412 | /* If this probe request is sent during P2P Search State, then we need |
| 413 | * to send it at OFDM rate. |
| 414 | */ |
Amruta Kulkarni | 453c4e2 | 2019-11-20 10:59:21 -0800 | [diff] [blame] | 415 | if ((REG_BAND_5G == lim_get_rf_band(chan_freq)) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 416 | /* |
| 417 | * For unicast probe req mgmt from Join function we don't set |
| 418 | * above variables. So we need to add one more check whether it |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 419 | * is opmode is P2P_CLIENT or not |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 420 | */ |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 421 | ((pesession) && (QDF_P2P_CLIENT_MODE == pesession->opmode))) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 422 | txflag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 423 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 424 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 425 | wma_tx_frame(mac_ctx, packet, |
| 426 | (uint16_t) sizeof(tSirMacMgmtHdr) + payload, |
| 427 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 428 | lim_tx_complete, frame, txflag, vdev_id, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 429 | 0, RATEID_DEFAULT); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 430 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 431 | pe_err("could not send Probe Request frame!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 432 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 433 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 434 | } |
| 435 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 436 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 437 | } /* End lim_send_probe_req_mgmt_frame. */ |
| 438 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 439 | 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] | 440 | uint8_t *addIE, uint16_t *addnIELen, |
| 441 | uint8_t probeReqP2pIe) |
| 442 | { |
| 443 | /* If Probe request doesn't have P2P IE, then take out P2P IE |
| 444 | from additional IE */ |
| 445 | if (!probeReqP2pIe) { |
| 446 | uint8_t *tempbuf = NULL; |
| 447 | uint16_t tempLen = 0; |
| 448 | int left = *addnIELen; |
| 449 | uint8_t *ptr = addIE; |
| 450 | uint8_t elem_id, elem_len; |
| 451 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 452 | if (!addIE) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 453 | pe_err("NULL addIE pointer"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 454 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 455 | } |
| 456 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 457 | tempbuf = qdf_mem_malloc(left); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 458 | if (!tempbuf) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 459 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 460 | |
| 461 | while (left >= 2) { |
| 462 | elem_id = ptr[0]; |
| 463 | elem_len = ptr[1]; |
| 464 | left -= 2; |
| 465 | if (elem_len > left) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 466 | pe_err("Invalid IEs eid: %d elem_len: %d left: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 467 | elem_id, elem_len, left); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 468 | qdf_mem_free(tempbuf); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 469 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 470 | } |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 471 | if (!((WLAN_ELEMID_VENDOR == elem_id) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 472 | (memcmp |
| 473 | (&ptr[2], SIR_MAC_P2P_OUI, |
| 474 | SIR_MAC_P2P_OUI_SIZE) == 0))) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 475 | qdf_mem_copy(tempbuf + tempLen, &ptr[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 476 | elem_len + 2); |
| 477 | tempLen += (elem_len + 2); |
| 478 | } |
| 479 | left -= elem_len; |
| 480 | ptr += (elem_len + 2); |
| 481 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 482 | qdf_mem_copy(addIE, tempbuf, tempLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 483 | *addnIELen = tempLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 484 | qdf_mem_free(tempbuf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 485 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 486 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 487 | } |
| 488 | |
Wu Gao | 8805369 | 2019-12-11 12:17:13 +0800 | [diff] [blame] | 489 | /** |
| 490 | * lim_add_additional_ie() - Add additional IE to management frame |
| 491 | * @frame: pointer to frame |
| 492 | * @frame_offset: current offset of frame |
| 493 | * @add_ie: pointer to addtional ie |
| 494 | * @add_ie_len: length of addtional ie |
| 495 | * @p2p_ie: pointer to p2p ie |
| 496 | * @noa_ie: pointer to noa ie, this is seperate p2p ie |
| 497 | * @noa_ie_len: length of noa ie |
| 498 | * @noa_stream: pointer to noa stream, this is noa attribute only |
| 499 | * @noa_stream_len: length of noa stream |
| 500 | * |
| 501 | * This function adds additional IE to management frame. |
| 502 | * |
| 503 | * Return: None |
| 504 | */ |
| 505 | static void lim_add_additional_ie(uint8_t *frame, uint32_t frame_offset, |
| 506 | uint8_t *add_ie, uint32_t add_ie_len, |
| 507 | uint8_t *p2p_ie, uint8_t *noa_ie, |
| 508 | uint32_t noa_ie_len, uint8_t *noa_stream, |
| 509 | uint32_t noa_stream_len) { |
| 510 | uint16_t p2p_ie_offset; |
| 511 | |
| 512 | if (!add_ie_len || !add_ie) { |
| 513 | pe_debug("no valid addtional ie"); |
| 514 | return; |
| 515 | } |
| 516 | |
| 517 | if (!noa_stream_len) { |
| 518 | qdf_mem_copy(frame + frame_offset, &add_ie[0], add_ie_len); |
| 519 | return; |
| 520 | } |
| 521 | |
| 522 | if (noa_ie_len > (SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN)) { |
| 523 | pe_err("Not able to insert NoA, len=%d", noa_ie_len); |
| 524 | return; |
| 525 | } else if (noa_ie_len > 0) { |
| 526 | pe_debug("new p2p ie for noa attr"); |
| 527 | qdf_mem_copy(frame + frame_offset, &add_ie[0], add_ie_len); |
| 528 | frame_offset += add_ie_len; |
| 529 | qdf_mem_copy(frame + frame_offset, &noa_ie[0], noa_ie_len); |
| 530 | } else { |
| 531 | if (!p2p_ie || (p2p_ie < add_ie) || |
| 532 | (p2p_ie > (add_ie + add_ie_len))) { |
| 533 | pe_err("invalid p2p ie"); |
| 534 | return; |
| 535 | } |
| 536 | p2p_ie_offset = p2p_ie - add_ie + p2p_ie[1] + 2; |
| 537 | if (p2p_ie_offset > add_ie_len) { |
| 538 | pe_err("Invalid p2p ie"); |
| 539 | return; |
| 540 | } |
| 541 | pe_debug("insert noa attr to existed p2p ie"); |
| 542 | p2p_ie[1] = p2p_ie[1] + noa_stream_len; |
| 543 | qdf_mem_copy(frame + frame_offset, &add_ie[0], p2p_ie_offset); |
| 544 | frame_offset += p2p_ie_offset; |
| 545 | qdf_mem_copy(frame + frame_offset, &noa_stream[0], |
| 546 | noa_stream_len); |
| 547 | if (p2p_ie_offset < add_ie_len) { |
| 548 | frame_offset += noa_stream_len; |
| 549 | qdf_mem_copy(frame + frame_offset, |
| 550 | &add_ie[p2p_ie_offset], |
| 551 | add_ie_len - p2p_ie_offset); |
| 552 | } |
| 553 | } |
| 554 | } |
| 555 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 556 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 557 | lim_send_probe_rsp_mgmt_frame(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 558 | tSirMacAddr peer_macaddr, |
| 559 | tpAniSSID ssid, |
Jeff Johnson | 3c08ace | 2019-03-12 08:50:37 -0700 | [diff] [blame] | 560 | struct pe_session *pe_session, |
| 561 | uint8_t preq_p2pie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 562 | { |
| 563 | tDot11fProbeResponse *frm; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 564 | QDF_STATUS sir_status; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 565 | uint32_t cfg, payload, bytes = 0, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 566 | tpSirMacMgmtHdr mac_hdr; |
| 567 | uint8_t *frame; |
Arif Hussain | fbf5068 | 2016-06-15 12:57:43 -0700 | [diff] [blame] | 568 | void *packet = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 569 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 570 | uint32_t addn_ie_present = false; |
| 571 | |
| 572 | uint16_t addn_ie_len = 0; |
gaurank kathpalia | 837f620 | 2018-09-14 21:55:32 +0530 | [diff] [blame] | 573 | bool wps_ap = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 574 | uint8_t tx_flag = 0; |
| 575 | uint8_t *add_ie = NULL; |
Wu Gao | 8805369 | 2019-12-11 12:17:13 +0800 | [diff] [blame] | 576 | uint8_t *p2p_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 577 | uint8_t noalen = 0; |
| 578 | uint8_t total_noalen = 0; |
| 579 | uint8_t noa_stream[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
| 580 | uint8_t noa_ie[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 581 | uint8_t vdev_id = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 582 | bool is_vht_enabled = false; |
Padma, Santhosh Kumar | 9223447 | 2017-04-19 18:20:02 +0530 | [diff] [blame] | 583 | tDot11fIEExtCap extracted_ext_cap = {0}; |
Selvaraj, Sridhar | 94ece20 | 2016-06-23 20:44:09 +0530 | [diff] [blame] | 584 | bool extracted_ext_cap_flag = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 585 | |
| 586 | /* We don't answer requests in this case*/ |
Srinivas Girigowda | 35b0031 | 2017-06-27 21:52:03 -0700 | [diff] [blame] | 587 | if (ANI_DRIVER_TYPE(mac_ctx) == QDF_DRIVER_TYPE_MFG) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 588 | return; |
| 589 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 590 | if (!pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 591 | return; |
| 592 | |
| 593 | /* |
| 594 | * In case when cac timer is running for this SAP session then |
| 595 | * avoid sending probe rsp out. It is violation of dfs specification. |
| 596 | */ |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 597 | if (((pe_session->opmode == QDF_SAP_MODE) || |
| 598 | (pe_session->opmode == QDF_P2P_GO_MODE)) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 599 | (true == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 600 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 601 | FL("CAC timer is running, probe response dropped")); |
| 602 | return; |
| 603 | } |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 604 | vdev_id = pe_session->vdev_id; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 605 | frm = qdf_mem_malloc(sizeof(tDot11fProbeResponse)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 606 | if (!frm) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 607 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 608 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 609 | /* |
| 610 | * Fill out 'frm', after which we'll just hand the struct off to |
| 611 | * 'dot11f_pack_probe_response'. |
| 612 | */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 613 | qdf_mem_zero((uint8_t *) frm, sizeof(tDot11fProbeResponse)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 614 | |
| 615 | /* |
| 616 | * Timestamp to be updated by TFP, below. |
| 617 | * |
| 618 | * Beacon Interval: |
| 619 | */ |
| 620 | if (LIM_IS_AP_ROLE(pe_session)) { |
| 621 | frm->BeaconInterval.interval = |
Jeff Johnson | ac05741 | 2019-01-06 11:08:55 -0800 | [diff] [blame] | 622 | mac_ctx->sch.beacon_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 623 | } else { |
Bala Venkatesh | 2fde2c6 | 2018-09-11 20:33:24 +0530 | [diff] [blame] | 624 | cfg = mac_ctx->mlme_cfg->sap_cfg.beacon_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 625 | frm->BeaconInterval.interval = (uint16_t) cfg; |
| 626 | } |
| 627 | |
| 628 | populate_dot11f_capabilities(mac_ctx, &frm->Capabilities, pe_session); |
| 629 | populate_dot11f_ssid(mac_ctx, (tSirMacSSid *) ssid, &frm->SSID); |
| 630 | populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 631 | &frm->SuppRates, pe_session); |
| 632 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 633 | populate_dot11f_ds_params( |
| 634 | mac_ctx, &frm->DSParams, |
| 635 | wlan_reg_freq_to_chan(mac_ctx->pdev, |
| 636 | pe_session->curr_op_freq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 637 | populate_dot11f_ibss_params(mac_ctx, &frm->IBSSParams, pe_session); |
| 638 | |
| 639 | if (LIM_IS_AP_ROLE(pe_session)) { |
| 640 | if (pe_session->wps_state != SAP_WPS_DISABLED) |
| 641 | populate_dot11f_probe_res_wpsi_es(mac_ctx, |
| 642 | &frm->WscProbeRes, |
| 643 | pe_session); |
| 644 | } else { |
gaurank kathpalia | 837f620 | 2018-09-14 21:55:32 +0530 | [diff] [blame] | 645 | wps_ap = mac_ctx->mlme_cfg->wps_params.enable_wps & |
| 646 | WNI_CFG_WPS_ENABLE_AP; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 647 | if (wps_ap) |
| 648 | populate_dot11f_wsc_in_probe_res(mac_ctx, |
| 649 | &frm->WscProbeRes); |
| 650 | |
| 651 | if (mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState == |
| 652 | eLIM_WSC_ENROLL_BEGIN) { |
| 653 | populate_dot11f_wsc_registrar_info_in_probe_res(mac_ctx, |
| 654 | &frm->WscProbeRes); |
| 655 | mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState = |
| 656 | eLIM_WSC_ENROLL_IN_PROGRESS; |
| 657 | } |
| 658 | |
| 659 | if (mac_ctx->lim.wscIeInfo.wscEnrollmentState == |
| 660 | eLIM_WSC_ENROLL_END) { |
| 661 | de_populate_dot11f_wsc_registrar_info_in_probe_res( |
| 662 | mac_ctx, &frm->WscProbeRes); |
| 663 | mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState = |
| 664 | eLIM_WSC_ENROLL_NOOP; |
| 665 | } |
| 666 | } |
| 667 | |
| 668 | populate_dot11f_country(mac_ctx, &frm->Country, pe_session); |
| 669 | populate_dot11f_edca_param_set(mac_ctx, &frm->EDCAParamSet, pe_session); |
| 670 | |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 671 | if (pe_session->dot11mode != MLME_DOT11_MODE_11B) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 672 | populate_dot11f_erp_info(mac_ctx, &frm->ERPInfo, pe_session); |
| 673 | |
| 674 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 675 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 676 | &frm->ExtSuppRates, pe_session); |
| 677 | |
| 678 | /* Populate HT IEs, when operating in 11n */ |
| 679 | if (pe_session->htCapability) { |
| 680 | populate_dot11f_ht_caps(mac_ctx, pe_session, &frm->HTCaps); |
| 681 | populate_dot11f_ht_info(mac_ctx, &frm->HTInfo, pe_session); |
| 682 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 683 | if (pe_session->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 684 | pe_debug("Populate VHT IE in Probe Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 685 | populate_dot11f_vht_caps(mac_ctx, pe_session, &frm->VHTCaps); |
| 686 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
| 687 | &frm->VHTOperation); |
| 688 | /* |
| 689 | * we do not support multi users yet. |
| 690 | * populate_dot11f_vht_ext_bss_load( mac_ctx, |
| 691 | * &frm.VHTExtBssLoad ); |
| 692 | */ |
| 693 | is_vht_enabled = true; |
| 694 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 695 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 696 | if (lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 697 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 698 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 699 | &frm->he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 700 | populate_dot11f_he_operation(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 701 | &frm->he_op); |
Manikandan Mohan | 8e4491c | 2019-10-23 16:00:51 -0700 | [diff] [blame] | 702 | populate_dot11f_he_6ghz_cap(mac_ctx, pe_session, |
| 703 | &frm->he_6ghz_band_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 704 | } |
| 705 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 706 | populate_dot11f_ext_cap(mac_ctx, is_vht_enabled, &frm->ExtCap, |
| 707 | pe_session); |
| 708 | |
| 709 | if (pe_session->pLimStartBssReq) { |
| 710 | populate_dot11f_wpa(mac_ctx, |
| 711 | &(pe_session->pLimStartBssReq->rsnIE), |
| 712 | &frm->WPA); |
| 713 | populate_dot11f_rsn_opaque(mac_ctx, |
| 714 | &(pe_session->pLimStartBssReq->rsnIE), |
| 715 | &frm->RSNOpaque); |
| 716 | } |
| 717 | |
| 718 | populate_dot11f_wmm(mac_ctx, &frm->WMMInfoAp, &frm->WMMParams, |
| 719 | &frm->WMMCaps, pe_session); |
| 720 | |
| 721 | #if defined(FEATURE_WLAN_WAPI) |
| 722 | if (pe_session->pLimStartBssReq) |
| 723 | populate_dot11f_wapi(mac_ctx, |
| 724 | &(pe_session->pLimStartBssReq->rsnIE), |
| 725 | &frm->WAPI); |
| 726 | #endif /* defined(FEATURE_WLAN_WAPI) */ |
| 727 | |
Liangwei Dong | d7c5e01 | 2018-12-16 23:56:50 -0500 | [diff] [blame] | 728 | /* |
| 729 | * Only use CFG for non-listen mode. This CFG is not working for |
| 730 | * concurrency. In listening mode, probe rsp IEs is passed in |
| 731 | * the message from SME to PE. |
| 732 | */ |
| 733 | addn_ie_present = |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 734 | (pe_session->add_ie_params.probeRespDataLen != 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 735 | |
| 736 | if (addn_ie_present) { |
| 737 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 738 | add_ie = qdf_mem_malloc( |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 739 | pe_session->add_ie_params.probeRespDataLen); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 740 | if (!add_ie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 741 | goto err_ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 742 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 743 | qdf_mem_copy(add_ie, |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 744 | pe_session->add_ie_params.probeRespData_buff, |
| 745 | pe_session->add_ie_params.probeRespDataLen); |
| 746 | addn_ie_len = pe_session->add_ie_params.probeRespDataLen; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 747 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 748 | 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] | 749 | add_ie, &addn_ie_len, preq_p2pie)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 750 | pe_err("Unable to get addn_ie"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 751 | goto err_ret; |
| 752 | } |
| 753 | |
| 754 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 755 | add_ie, &addn_ie_len, |
| 756 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 757 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 758 | pe_debug("Unable to strip off ExtCap IE"); |
Selvaraj, Sridhar | 94ece20 | 2016-06-23 20:44:09 +0530 | [diff] [blame] | 759 | } else { |
| 760 | extracted_ext_cap_flag = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 761 | } |
| 762 | |
| 763 | bytes = bytes + addn_ie_len; |
| 764 | |
| 765 | if (preq_p2pie) |
Wu Gao | 8805369 | 2019-12-11 12:17:13 +0800 | [diff] [blame] | 766 | p2p_ie = (uint8_t *)limGetP2pIEPtr(mac_ctx, &add_ie[0], |
| 767 | addn_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 768 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 769 | if (p2p_ie) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 770 | /* get NoA attribute stream P2P IE */ |
| 771 | noalen = lim_get_noa_attr_stream(mac_ctx, |
| 772 | noa_stream, pe_session); |
Wu Gao | 8805369 | 2019-12-11 12:17:13 +0800 | [diff] [blame] | 773 | if (noalen) { |
| 774 | if ((p2p_ie[1] + noalen) > |
| 775 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN) { |
| 776 | total_noalen = lim_build_p2p_ie( |
| 777 | mac_ctx, |
| 778 | &noa_ie[0], |
| 779 | &noa_stream[0], |
| 780 | noalen); |
| 781 | bytes = bytes + total_noalen; |
| 782 | } else { |
| 783 | bytes = bytes + noalen; |
| 784 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 785 | } |
| 786 | } |
| 787 | } |
| 788 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 789 | /* |
| 790 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 791 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 792 | * dot11f get packed payload size. |
| 793 | */ |
| 794 | if (extracted_ext_cap_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 795 | lim_merge_extcap_struct(&frm->ExtCap, &extracted_ext_cap, |
| 796 | true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 797 | |
| 798 | status = dot11f_get_packed_probe_response_size(mac_ctx, frm, &payload); |
| 799 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 800 | pe_err("Probe Response size error (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 801 | status); |
| 802 | /* We'll fall back on the worst case scenario: */ |
| 803 | payload = sizeof(tDot11fProbeResponse); |
| 804 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 805 | pe_warn("Probe Response size warning (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 806 | status); |
| 807 | } |
| 808 | |
| 809 | bytes += payload + sizeof(tSirMacMgmtHdr); |
| 810 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 811 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 812 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 813 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 814 | pe_err("Probe Response allocation failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 815 | goto err_ret; |
| 816 | } |
| 817 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 818 | qdf_mem_zero(frame, bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 819 | |
| 820 | /* Next, we fill out the buffer descriptor: */ |
| 821 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 822 | SIR_MAC_MGMT_PROBE_RSP, peer_macaddr, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 823 | pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 824 | |
| 825 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 826 | |
| 827 | sir_copy_mac_addr(mac_hdr->bssId, pe_session->bssId); |
| 828 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 829 | /* That done, pack the Probe Response: */ |
| 830 | status = |
| 831 | dot11f_pack_probe_response(mac_ctx, frm, |
| 832 | frame + sizeof(tSirMacMgmtHdr), |
| 833 | payload, &payload); |
| 834 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 835 | pe_err("Probe Response pack failure (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 836 | status); |
| 837 | goto err_ret; |
| 838 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 839 | pe_warn("Probe Response pack warning (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 840 | } |
| 841 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 842 | pe_debug("Sending Probe Response frame to"); |
Nishank Aggarwal | 46bd31a | 2017-03-10 16:23:53 +0530 | [diff] [blame] | 843 | lim_print_mac_addr(mac_ctx, peer_macaddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 844 | |
Wu Gao | 8805369 | 2019-12-11 12:17:13 +0800 | [diff] [blame] | 845 | lim_add_additional_ie(frame, sizeof(tSirMacMgmtHdr) + payload, add_ie, |
| 846 | addn_ie_len, p2p_ie, noa_ie, total_noalen, |
| 847 | noa_stream, noalen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 848 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 849 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 850 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 851 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 852 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 853 | |
| 854 | /* Queue Probe Response frame in high priority WQ */ |
Jeff Johnson | 59429b0 | 2018-11-07 13:53:18 -0800 | [diff] [blame] | 855 | qdf_status = wma_tx_frame(mac_ctx, packet, |
| 856 | (uint16_t)bytes, |
| 857 | TXRX_FRM_802_11_MGMT, |
| 858 | ANI_TXDIR_TODS, |
| 859 | 7, lim_tx_complete, frame, tx_flag, |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 860 | vdev_id, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 861 | |
| 862 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 863 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 864 | pe_err("Could not send Probe Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 865 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 866 | if (add_ie) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 867 | qdf_mem_free(add_ie); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 868 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 869 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 870 | return; |
| 871 | |
| 872 | err_ret: |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 873 | if (add_ie) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 874 | qdf_mem_free(add_ie); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 875 | if (frm) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 876 | qdf_mem_free(frm); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 877 | if (packet) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 878 | cds_packet_free((void *)packet); |
| 879 | return; |
| 880 | |
| 881 | } /* End lim_send_probe_rsp_mgmt_frame. */ |
| 882 | |
| 883 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 884 | lim_send_addts_req_action_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 885 | tSirMacAddr peerMacAddr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 886 | tSirAddtsReqInfo *pAddTS, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 887 | { |
| 888 | uint16_t i; |
| 889 | uint8_t *pFrame; |
| 890 | tDot11fAddTSRequest AddTSReq; |
| 891 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 892 | uint32_t nPayload, nBytes, nStatus; |
| 893 | tpSirMacMgmtHdr pMacHdr; |
| 894 | void *pPacket; |
| 895 | #ifdef FEATURE_WLAN_ESE |
| 896 | uint32_t phyMode; |
| 897 | #endif |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 898 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 899 | uint8_t txFlag = 0; |
| 900 | uint8_t smeSessionId = 0; |
| 901 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 902 | if (!pe_session) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 903 | return; |
| 904 | } |
| 905 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 906 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 907 | |
| 908 | if (!pAddTS->wmeTspecPresent) { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 909 | qdf_mem_zero((uint8_t *) &AddTSReq, sizeof(AddTSReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 910 | |
Srinivas Girigowda | 03cebc3 | 2019-05-17 16:50:31 -0700 | [diff] [blame] | 911 | AddTSReq.Action.action = QOS_ADD_TS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 912 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 913 | AddTSReq.Category.category = ACTION_CATEGORY_QOS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 914 | if (pAddTS->lleTspecPresent) { |
| 915 | populate_dot11f_tspec(&pAddTS->tspec, &AddTSReq.TSPEC); |
| 916 | } else { |
| 917 | populate_dot11f_wmmtspec(&pAddTS->tspec, |
| 918 | &AddTSReq.WMMTSPEC); |
| 919 | } |
| 920 | |
| 921 | if (pAddTS->lleTspecPresent) { |
| 922 | AddTSReq.num_WMMTCLAS = 0; |
| 923 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 924 | for (i = 0; i < pAddTS->numTclas; ++i) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 925 | populate_dot11f_tclas(mac, &pAddTS->tclasInfo[i], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 926 | &AddTSReq.TCLAS[i]); |
| 927 | } |
| 928 | } else { |
| 929 | AddTSReq.num_TCLAS = 0; |
| 930 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 931 | for (i = 0; i < pAddTS->numTclas; ++i) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 932 | populate_dot11f_wmmtclas(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 933 | &pAddTS->tclasInfo[i], |
| 934 | &AddTSReq.WMMTCLAS[i]); |
| 935 | } |
| 936 | } |
| 937 | |
| 938 | if (pAddTS->tclasProcPresent) { |
| 939 | if (pAddTS->lleTspecPresent) { |
| 940 | AddTSReq.TCLASSPROC.processing = |
| 941 | pAddTS->tclasProc; |
| 942 | AddTSReq.TCLASSPROC.present = 1; |
| 943 | } else { |
| 944 | AddTSReq.WMMTCLASPROC.version = 1; |
| 945 | AddTSReq.WMMTCLASPROC.processing = |
| 946 | pAddTS->tclasProc; |
| 947 | AddTSReq.WMMTCLASPROC.present = 1; |
| 948 | } |
| 949 | } |
| 950 | |
| 951 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 952 | dot11f_get_packed_add_ts_request_size(mac, &AddTSReq, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 953 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 954 | pe_err("Failed to calculate the packed size for an Add TS Request (0x%08x)", |
| 955 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 956 | /* We'll fall back on the worst case scenario: */ |
| 957 | nPayload = sizeof(tDot11fAddTSRequest); |
| 958 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 959 | pe_warn("There were warnings while calculating the packed size for an Add TS Request (0x%08x)", |
| 960 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 961 | } |
| 962 | } else { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 963 | qdf_mem_zero((uint8_t *) &WMMAddTSReq, sizeof(WMMAddTSReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 964 | |
Srinivas Girigowda | 03cebc3 | 2019-05-17 16:50:31 -0700 | [diff] [blame] | 965 | WMMAddTSReq.Action.action = QOS_ADD_TS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 966 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 967 | WMMAddTSReq.Category.category = ACTION_CATEGORY_WMM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 968 | |
| 969 | /* WMM spec 2.2.10 - status code is only filled in for ADDTS response */ |
| 970 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 971 | |
| 972 | populate_dot11f_wmmtspec(&pAddTS->tspec, &WMMAddTSReq.WMMTSPEC); |
| 973 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 974 | lim_get_phy_mode(mac, &phyMode, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 975 | |
| 976 | if (phyMode == WNI_CFG_PHY_MODE_11G |
| 977 | || phyMode == WNI_CFG_PHY_MODE_11A) { |
| 978 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 979 | } else { |
| 980 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 981 | } |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 982 | populate_dot11_tsrsie(mac, &pAddTS->tsrsIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 983 | &WMMAddTSReq.ESETrafStrmRateSet, |
| 984 | sizeof(uint8_t)); |
| 985 | #endif |
| 986 | /* fillWmeTspecIE */ |
| 987 | |
| 988 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 989 | dot11f_get_packed_wmm_add_ts_request_size(mac, &WMMAddTSReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 990 | &nPayload); |
| 991 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 992 | 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] | 993 | nStatus); |
| 994 | /* We'll fall back on the worst case scenario: */ |
| 995 | nPayload = sizeof(tDot11fAddTSRequest); |
| 996 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 997 | pe_warn("There were warnings while calculating the packed size for a WMM Add TS Request (0x%08x)", |
| 998 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 999 | } |
| 1000 | } |
| 1001 | |
| 1002 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 1003 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1004 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1005 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1006 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1007 | pe_err("Failed to allocate %d bytes for an Add TS Request", |
| 1008 | nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1009 | return; |
| 1010 | } |
| 1011 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1012 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1013 | |
| 1014 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1015 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 1016 | SIR_MAC_MGMT_ACTION, peerMacAddr, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1017 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 1018 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1019 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1020 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1021 | lim_set_protected_bit(mac, pe_session, peerMacAddr, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1022 | |
| 1023 | /* That done, pack the struct: */ |
| 1024 | if (!pAddTS->wmeTspecPresent) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1025 | nStatus = dot11f_pack_add_ts_request(mac, &AddTSReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1026 | pFrame + |
| 1027 | sizeof(tSirMacMgmtHdr), |
| 1028 | nPayload, &nPayload); |
| 1029 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1030 | pe_err("Failed to pack an Add TS Request " |
| 1031 | "(0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1032 | cds_packet_free((void *)pPacket); |
| 1033 | return; /* allocated! */ |
| 1034 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1035 | pe_warn("There were warnings while packing an Add TS Request (0x%08x)", |
| 1036 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1037 | } |
| 1038 | } else { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1039 | nStatus = dot11f_pack_wmm_add_ts_request(mac, &WMMAddTSReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1040 | pFrame + |
| 1041 | sizeof(tSirMacMgmtHdr), |
| 1042 | nPayload, &nPayload); |
| 1043 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1044 | pe_err("Failed to pack a WMM Add TS Request (0x%08x)", |
| 1045 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1046 | cds_packet_free((void *)pPacket); |
| 1047 | return; /* allocated! */ |
| 1048 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1049 | pe_warn("There were warnings while packing a WMM Add TS Request (0x%08x)", |
| 1050 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1051 | } |
| 1052 | } |
| 1053 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1054 | pe_debug("Sending an Add TS Request frame to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1055 | lim_print_mac_addr(mac, peerMacAddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1056 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 1057 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 1058 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 1059 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1060 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1061 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1062 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1063 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1064 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1065 | pe_session, QDF_STATUS_SUCCESS, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1066 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1067 | |
| 1068 | /* Queue Addts Response frame in high priority WQ */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1069 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1070 | TXRX_FRM_802_11_MGMT, |
| 1071 | ANI_TXDIR_TODS, |
| 1072 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1073 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1074 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1075 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1076 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1077 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 1078 | pe_err("Could not send an Add TS Request (%X", |
| 1079 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1080 | } /* End lim_send_addts_req_action_frame. */ |
| 1081 | |
| 1082 | /** |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1083 | * lim_assoc_rsp_tx_complete() - Confirmation for assoc rsp OTA |
| 1084 | * @context: pointer to global mac |
| 1085 | * @buf: buffer which is nothing but entire assoc rsp frame |
| 1086 | * @tx_complete : Sent status |
| 1087 | * @params; tx completion params |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1088 | * |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1089 | * Return: This returns QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1090 | */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1091 | static QDF_STATUS lim_assoc_rsp_tx_complete( |
| 1092 | void *context, |
| 1093 | qdf_nbuf_t buf, |
| 1094 | uint32_t tx_complete, |
| 1095 | void *params) |
| 1096 | { |
| 1097 | struct mac_context *mac_ctx = (struct mac_context *)context; |
| 1098 | tSirMacMgmtHdr *mac_hdr; |
| 1099 | struct pe_session *session_entry; |
| 1100 | uint8_t session_id; |
| 1101 | tpLimMlmAssocInd lim_assoc_ind; |
| 1102 | tpDphHashNode sta_ds; |
| 1103 | uint16_t aid; |
| 1104 | uint8_t *data; |
| 1105 | struct assoc_ind *sme_assoc_ind; |
| 1106 | struct scheduler_msg msg; |
| 1107 | tpSirAssocReq assoc_req; |
| 1108 | |
| 1109 | if (!buf) { |
| 1110 | pe_err("Assoc rsp frame buffer is NULL"); |
| 1111 | goto null_buf; |
| 1112 | } |
| 1113 | |
| 1114 | data = qdf_nbuf_data(buf); |
| 1115 | |
| 1116 | if (!data) { |
| 1117 | pe_err("Assoc rsp frame is NULL"); |
| 1118 | goto end; |
| 1119 | } |
| 1120 | |
| 1121 | mac_hdr = (tSirMacMgmtHdr *)data; |
| 1122 | |
| 1123 | session_entry = pe_find_session_by_bssid( |
| 1124 | mac_ctx, mac_hdr->sa, |
| 1125 | &session_id); |
| 1126 | if (!session_entry) { |
| 1127 | pe_err("session entry is NULL"); |
| 1128 | goto end; |
| 1129 | } |
| 1130 | |
| 1131 | sta_ds = dph_lookup_hash_entry(mac_ctx, |
| 1132 | (uint8_t *)mac_hdr->da, &aid, |
| 1133 | &session_entry->dph.dphHashTable); |
| 1134 | if (!sta_ds) { |
| 1135 | pe_err("sta_ds is NULL"); |
| 1136 | goto end; |
| 1137 | } |
| 1138 | |
| 1139 | /* Get a copy of the already parsed Assoc Request */ |
| 1140 | assoc_req = |
| 1141 | (tpSirAssocReq)session_entry->parsedAssocReq[sta_ds->assocId]; |
| 1142 | |
| 1143 | if (!assoc_req) { |
| 1144 | pe_err("assoc req for assoc_id:%d is NULL", sta_ds->assocId); |
| 1145 | goto end; |
| 1146 | } |
| 1147 | |
| 1148 | lim_assoc_ind = qdf_mem_malloc(sizeof(tLimMlmAssocInd)); |
| 1149 | if (!lim_assoc_ind) { |
| 1150 | pe_err("lim assoc ind is NULL"); |
| 1151 | goto free_assoc_req; |
| 1152 | } |
| 1153 | if (!lim_fill_lim_assoc_ind_params(lim_assoc_ind, mac_ctx, |
| 1154 | sta_ds, session_entry)) { |
| 1155 | pe_err("lim assoc ind fill error"); |
| 1156 | goto lim_assoc_ind; |
| 1157 | } |
| 1158 | |
| 1159 | sme_assoc_ind = qdf_mem_malloc(sizeof(struct assoc_ind)); |
| 1160 | if (!sme_assoc_ind) { |
| 1161 | pe_err("sme assoc ind is NULL"); |
| 1162 | goto lim_assoc_ind; |
| 1163 | } |
| 1164 | sme_assoc_ind->messageType = eWNI_SME_ASSOC_IND_UPPER_LAYER; |
| 1165 | lim_fill_sme_assoc_ind_params( |
| 1166 | mac_ctx, lim_assoc_ind, |
| 1167 | sme_assoc_ind, |
Chaoli Zhou | 98d1b3e | 2019-10-10 17:13:44 +0800 | [diff] [blame] | 1168 | session_entry, true); |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1169 | |
| 1170 | qdf_mem_zero(&msg, sizeof(struct scheduler_msg)); |
| 1171 | msg.type = eWNI_SME_ASSOC_IND_UPPER_LAYER; |
| 1172 | msg.bodyptr = sme_assoc_ind; |
| 1173 | msg.bodyval = 0; |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1174 | sme_assoc_ind->reassocReq = sta_ds->mlmStaContext.subType; |
| 1175 | sme_assoc_ind->timingMeasCap = sta_ds->timingMeasCap; |
Chaoli Zhou | 98d1b3e | 2019-10-10 17:13:44 +0800 | [diff] [blame] | 1176 | MTRACE(mac_trace_msg_tx(mac_ctx, session_entry->peSessionId, msg.type)); |
| 1177 | lim_sys_process_mmh_msg_api(mac_ctx, &msg); |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1178 | |
| 1179 | qdf_mem_free(lim_assoc_ind); |
| 1180 | if (assoc_req->assocReqFrame) { |
| 1181 | qdf_mem_free(assoc_req->assocReqFrame); |
| 1182 | assoc_req->assocReqFrame = NULL; |
| 1183 | } |
| 1184 | qdf_mem_free(session_entry->parsedAssocReq[sta_ds->assocId]); |
| 1185 | session_entry->parsedAssocReq[sta_ds->assocId] = NULL; |
| 1186 | qdf_nbuf_free(buf); |
| 1187 | |
| 1188 | return QDF_STATUS_SUCCESS; |
| 1189 | |
| 1190 | lim_assoc_ind: |
| 1191 | qdf_mem_free(lim_assoc_ind); |
| 1192 | free_assoc_req: |
| 1193 | if (assoc_req->assocReqFrame) { |
| 1194 | qdf_mem_free(assoc_req->assocReqFrame); |
| 1195 | assoc_req->assocReqFrame = NULL; |
| 1196 | } |
| 1197 | qdf_mem_free(session_entry->parsedAssocReq[sta_ds->assocId]); |
| 1198 | session_entry->parsedAssocReq[sta_ds->assocId] = NULL; |
| 1199 | end: |
| 1200 | qdf_nbuf_free(buf); |
| 1201 | null_buf: |
| 1202 | return QDF_STATUS_E_FAILURE; |
| 1203 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1204 | |
| 1205 | void |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1206 | lim_send_assoc_rsp_mgmt_frame( |
| 1207 | struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1208 | uint16_t status_code, uint16_t aid, tSirMacAddr peer_addr, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1209 | uint8_t subtype, tpDphHashNode sta, struct pe_session *pe_session, |
| 1210 | bool tx_complete) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1211 | { |
| 1212 | static tDot11fAssocResponse frm; |
| 1213 | uint8_t *frame; |
| 1214 | tpSirMacMgmtHdr mac_hdr; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1215 | QDF_STATUS sir_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1216 | uint8_t lle_mode = 0, addts; |
| 1217 | tHalBitVal qos_mode, wme_mode; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1218 | uint32_t payload, bytes = 0, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1219 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1220 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1221 | tUpdateBeaconParams beacon_params; |
| 1222 | uint8_t tx_flag = 0; |
| 1223 | uint32_t addn_ie_len = 0; |
| 1224 | uint8_t add_ie[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1225 | tpSirAssocReq assoc_req = NULL; |
| 1226 | uint8_t sme_session = 0; |
| 1227 | bool is_vht = false; |
| 1228 | uint16_t stripoff_len = 0; |
| 1229 | tDot11fIEExtCap extracted_ext_cap; |
| 1230 | bool extracted_flag = false; |
| 1231 | #ifdef WLAN_FEATURE_11W |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 1232 | uint8_t retry_int; |
| 1233 | uint16_t max_retries; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1234 | #endif |
| 1235 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1236 | if (!pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1237 | pe_err("pe_session is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1238 | return; |
| 1239 | } |
| 1240 | |
| 1241 | sme_session = pe_session->smeSessionId; |
| 1242 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1243 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1244 | |
| 1245 | limGetQosMode(pe_session, &qos_mode); |
| 1246 | limGetWmeMode(pe_session, &wme_mode); |
| 1247 | |
| 1248 | /* |
| 1249 | * An Add TS IE is added only if the AP supports it and |
| 1250 | * the requesting STA sent a traffic spec. |
| 1251 | */ |
| 1252 | addts = (qos_mode && sta && sta->qos.addtsPresent) ? 1 : 0; |
| 1253 | |
| 1254 | frm.Status.status = status_code; |
| 1255 | |
| 1256 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1257 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1258 | if (!sta) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1259 | populate_dot11f_supp_rates(mac_ctx, |
| 1260 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1261 | &frm.SuppRates, pe_session); |
| 1262 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 1263 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1264 | &frm.ExtSuppRates, pe_session); |
| 1265 | } else { |
| 1266 | populate_dot11f_assoc_rsp_rates(mac_ctx, &frm.SuppRates, |
| 1267 | &frm.ExtSuppRates, |
| 1268 | sta->supportedRates.llbRates, |
| 1269 | sta->supportedRates.llaRates); |
| 1270 | } |
| 1271 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1272 | if (LIM_IS_AP_ROLE(pe_session) && sta && |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1273 | QDF_STATUS_SUCCESS == status_code) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1274 | assoc_req = (tpSirAssocReq) |
| 1275 | pe_session->parsedAssocReq[sta->assocId]; |
| 1276 | /* |
Pragaspathi Thilagaraj | f812ccf | 2019-06-22 13:07:04 +0530 | [diff] [blame] | 1277 | * populate P2P IE in AssocRsp when assoc_req from the peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1278 | * includes P2P IE |
| 1279 | */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1280 | if (assoc_req && assoc_req->addIEPresent) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1281 | populate_dot11_assoc_res_p2p_ie(mac_ctx, |
| 1282 | &frm.P2PAssocRes, |
| 1283 | assoc_req); |
| 1284 | } |
| 1285 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1286 | if (sta) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1287 | if (eHAL_SET == qos_mode) { |
| 1288 | if (sta->lleEnabled) { |
| 1289 | lle_mode = 1; |
| 1290 | populate_dot11f_edca_param_set(mac_ctx, |
| 1291 | &frm.EDCAParamSet, pe_session); |
| 1292 | } |
| 1293 | } |
| 1294 | |
| 1295 | if ((!lle_mode) && (eHAL_SET == wme_mode) && sta->wmeEnabled) { |
| 1296 | populate_dot11f_wmm_params(mac_ctx, &frm.WMMParams, |
| 1297 | pe_session); |
| 1298 | |
| 1299 | if (sta->wsmEnabled) |
| 1300 | populate_dot11f_wmm_caps(&frm.WMMCaps); |
| 1301 | } |
| 1302 | |
| 1303 | if (sta->mlmStaContext.htCapability && |
| 1304 | pe_session->htCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1305 | pe_debug("Populate HT IEs in Assoc Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1306 | populate_dot11f_ht_caps(mac_ctx, pe_session, |
| 1307 | &frm.HTCaps); |
Krunal Soni | ef3294b | 2015-06-12 15:12:19 -0700 | [diff] [blame] | 1308 | /* |
| 1309 | * Check the STA capability and |
| 1310 | * update the HTCaps accordingly |
| 1311 | */ |
| 1312 | frm.HTCaps.supportedChannelWidthSet = ( |
| 1313 | sta->htSupportedChannelWidthSet < |
| 1314 | pe_session->htSupportedChannelWidthSet) ? |
| 1315 | sta->htSupportedChannelWidthSet : |
| 1316 | pe_session->htSupportedChannelWidthSet; |
| 1317 | if (!frm.HTCaps.supportedChannelWidthSet) |
| 1318 | frm.HTCaps.shortGI40MHz = 0; |
| 1319 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1320 | populate_dot11f_ht_info(mac_ctx, &frm.HTInfo, |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 1321 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1322 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1323 | 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] | 1324 | frm.HTCaps.supportedChannelWidthSet, |
| 1325 | frm.HTCaps.mimoPowerSave, |
| 1326 | frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, |
| 1327 | frm.HTCaps.shortGI40MHz, |
| 1328 | frm.HTCaps.dsssCckMode40MHz, |
| 1329 | frm.HTCaps.maxRxAMPDUFactor); |
| 1330 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1331 | if (sta->mlmStaContext.vhtCapability && |
| 1332 | pe_session->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1333 | pe_debug("Populate VHT IEs in Assoc Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1334 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
| 1335 | &frm.VHTCaps); |
| 1336 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1337 | &frm.VHTOperation); |
| 1338 | is_vht = true; |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 1339 | } else if (sta->mlmStaContext.force_1x1 && |
| 1340 | frm.HTCaps.present) { |
| 1341 | /* |
| 1342 | * WAR: In P2P GO mode, if the P2P client device |
| 1343 | * is only HT capable and not VHT capable, but the P2P |
| 1344 | * GO device is VHT capable and advertises 2x2 NSS with |
| 1345 | * HT capablity client device, which results in IOT |
| 1346 | * issues. |
| 1347 | * When GO is operating in DBS mode, GO beacons |
| 1348 | * advertise 2x2 capability but include OMN IE to |
| 1349 | * indicate current operating mode of 1x1. But here |
| 1350 | * peer device is only HT capable and will not |
| 1351 | * understand OMN IE. |
| 1352 | */ |
| 1353 | frm.HTInfo.basicMCSSet[1] = 0; |
| 1354 | frm.HTCaps.supportedMCSSet[1] = 0; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1355 | } |
Naveen Rawat | 903acca | 2017-09-15 17:32:13 -0700 | [diff] [blame] | 1356 | |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1357 | if (pe_session->vhtCapability && |
| 1358 | pe_session->vendor_vht_sap && |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1359 | (assoc_req) && |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1360 | assoc_req->vendor_vht_ie.VHTCaps.present) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1361 | pe_debug("Populate Vendor VHT IEs in Assoc Rsponse"); |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1362 | frm.vendor_vht_ie.present = 1; |
Kiran Kumar Lokere | 8172263 | 2017-09-26 12:11:43 -0700 | [diff] [blame] | 1363 | frm.vendor_vht_ie.sub_type = |
| 1364 | pe_session->vendor_specific_vht_ie_sub_type; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1365 | frm.vendor_vht_ie.VHTCaps.present = 1; |
| 1366 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
| 1367 | &frm.vendor_vht_ie.VHTCaps); |
Kiran Kumar Lokere | cc44868 | 2017-07-20 18:08:01 -0700 | [diff] [blame] | 1368 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
| 1369 | &frm.vendor_vht_ie.VHTOperation); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1370 | is_vht = true; |
Kiran Kumar Lokere | 89f01f0 | 2019-08-06 18:22:39 -0700 | [diff] [blame] | 1371 | populate_dot11f_qcn_ie(mac_ctx, &frm.qcn_ie, |
| 1372 | QCN_IE_ATTR_ID_ALL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1373 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1374 | populate_dot11f_ext_cap(mac_ctx, is_vht, &frm.ExtCap, |
| 1375 | pe_session); |
| 1376 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1377 | if (lim_is_sta_he_capable(sta) && |
| 1378 | lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1379 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1380 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1381 | &frm.he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1382 | populate_dot11f_he_operation(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1383 | &frm.he_op); |
Kiran Kumar Lokere | b2ea027 | 2019-08-27 19:16:36 -0700 | [diff] [blame] | 1384 | populate_dot11f_he_6ghz_cap(mac_ctx, pe_session, |
| 1385 | &frm.he_6ghz_band_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1386 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1387 | #ifdef WLAN_FEATURE_11W |
| 1388 | if (eSIR_MAC_TRY_AGAIN_LATER == status_code) { |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 1389 | max_retries = |
| 1390 | mac_ctx->mlme_cfg->gen.pmf_sa_query_max_retries; |
| 1391 | retry_int = |
| 1392 | mac_ctx->mlme_cfg->gen.pmf_sa_query_retry_interval; |
| 1393 | populate_dot11f_timeout_interval(mac_ctx, |
| 1394 | &frm.TimeoutInterval, |
| 1395 | SIR_MAC_TI_TYPE_ASSOC_COMEBACK, |
| 1396 | (max_retries - |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1397 | sta->pmfSaQueryRetryCount) |
| 1398 | * retry_int); |
| 1399 | } |
| 1400 | #endif |
Arif Hussain | 0c81692 | 2017-04-06 15:04:44 -0700 | [diff] [blame] | 1401 | |
| 1402 | if (LIM_IS_AP_ROLE(pe_session) && sta->non_ecsa_capable) |
| 1403 | pe_session->lim_non_ecsa_cap_num++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1404 | } |
| 1405 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1406 | qdf_mem_zero((uint8_t *) &beacon_params, sizeof(beacon_params)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1407 | |
| 1408 | if (LIM_IS_AP_ROLE(pe_session) && |
Pragaspathi Thilagaraj | 1ee7600 | 2018-09-18 21:38:51 +0530 | [diff] [blame] | 1409 | (pe_session->gLimProtectionControl != |
| 1410 | MLME_FORCE_POLICY_PROTECTION_DISABLE)) |
| 1411 | lim_decide_ap_protection(mac_ctx, peer_addr, &beacon_params, |
| 1412 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1413 | |
| 1414 | lim_update_short_preamble(mac_ctx, peer_addr, &beacon_params, |
| 1415 | pe_session); |
| 1416 | lim_update_short_slot_time(mac_ctx, peer_addr, &beacon_params, |
| 1417 | pe_session); |
| 1418 | |
| 1419 | /* |
| 1420 | * Populate Do11capabilities after updating session with |
| 1421 | * Assos req details |
| 1422 | */ |
| 1423 | populate_dot11f_capabilities(mac_ctx, &frm.Capabilities, pe_session); |
| 1424 | |
Abhishek Singh | c70afa3 | 2019-09-19 15:17:21 +0530 | [diff] [blame] | 1425 | beacon_params.bss_idx = pe_session->vdev_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1426 | |
| 1427 | /* Send message to HAL about beacon parameter change. */ |
| 1428 | if ((false == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running) |
| 1429 | && beacon_params.paramChangeBitmap) { |
| 1430 | sch_set_fixed_beacon_fields(mac_ctx, pe_session); |
| 1431 | lim_send_beacon_params(mac_ctx, &beacon_params, pe_session); |
| 1432 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1433 | |
Arif Hussain | 1513cb2 | 2018-01-05 19:56:31 -0800 | [diff] [blame] | 1434 | lim_obss_send_detection_cfg(mac_ctx, pe_session, false); |
| 1435 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1436 | if (assoc_req) { |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 1437 | addn_ie_len = pe_session->add_ie_params.assocRespDataLen; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1438 | |
| 1439 | /* Nonzero length indicates Assoc rsp IE available */ |
Krishna Kumaar Natarajan | e4e3a14 | 2016-04-01 16:27:51 -0700 | [diff] [blame] | 1440 | if (addn_ie_len > 0 && |
| 1441 | addn_ie_len <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && |
| 1442 | (bytes + addn_ie_len) <= SIR_MAX_PACKET_SIZE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1443 | qdf_mem_copy(add_ie, |
Jeff Johnson | 21aac3a | 2019-02-02 14:26:13 -0800 | [diff] [blame] | 1444 | pe_session->add_ie_params.assocRespData_buff, |
| 1445 | pe_session->add_ie_params.assocRespDataLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1446 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1447 | qdf_mem_zero((uint8_t *) &extracted_ext_cap, |
| 1448 | sizeof(extracted_ext_cap)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1449 | |
| 1450 | stripoff_len = addn_ie_len; |
| 1451 | sir_status = |
| 1452 | lim_strip_extcap_update_struct |
| 1453 | (mac_ctx, &add_ie[0], &stripoff_len, |
| 1454 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1455 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1456 | pe_debug("strip off extcap IE failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1457 | } else { |
| 1458 | addn_ie_len = stripoff_len; |
| 1459 | extracted_flag = true; |
| 1460 | } |
| 1461 | bytes = bytes + addn_ie_len; |
| 1462 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1463 | pe_debug("addn_ie_len: %d for Assoc Resp: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1464 | addn_ie_len, assoc_req->addIEPresent); |
| 1465 | } |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1466 | |
| 1467 | /* |
| 1468 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 1469 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 1470 | * dot11f get packed payload size. |
| 1471 | */ |
| 1472 | if (extracted_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1473 | lim_merge_extcap_struct(&(frm.ExtCap), &extracted_ext_cap, |
| 1474 | true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1475 | |
| 1476 | /* Allocate a buffer for this frame: */ |
| 1477 | status = dot11f_get_packed_assoc_response_size(mac_ctx, &frm, &payload); |
| 1478 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1479 | pe_err("get Association Response size failure (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1480 | status); |
| 1481 | return; |
| 1482 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1483 | pe_warn("get Association Response size warning (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1484 | status); |
| 1485 | } |
| 1486 | |
| 1487 | bytes += sizeof(tSirMacMgmtHdr) + payload; |
| 1488 | |
Min Liu | 0daa098 | 2019-02-01 17:50:44 +0800 | [diff] [blame] | 1489 | if (sta) |
| 1490 | bytes += sta->mlmStaContext.owe_ie_len; |
| 1491 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1492 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1493 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1494 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1495 | pe_err("cds_packet_alloc failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1496 | return; |
| 1497 | } |
| 1498 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1499 | qdf_mem_zero(frame, bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1500 | |
| 1501 | /* Next, we fill out the buffer descriptor: */ |
| 1502 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 1503 | (LIM_ASSOC == subtype) ? |
| 1504 | SIR_MAC_MGMT_ASSOC_RSP : SIR_MAC_MGMT_REASSOC_RSP, |
| 1505 | peer_addr, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 1506 | pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1507 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 1508 | |
| 1509 | sir_copy_mac_addr(mac_hdr->bssId, pe_session->bssId); |
| 1510 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1511 | status = dot11f_pack_assoc_response(mac_ctx, &frm, |
| 1512 | frame + sizeof(tSirMacMgmtHdr), |
| 1513 | payload, &payload); |
| 1514 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1515 | pe_err("Association Response pack failure(0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1516 | status); |
| 1517 | cds_packet_free((void *)packet); |
| 1518 | return; |
| 1519 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1520 | pe_warn("Association Response pack warning (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1521 | status); |
| 1522 | } |
| 1523 | |
| 1524 | if (subtype == LIM_ASSOC) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1525 | pe_debug("*** Sending Assoc Resp status %d aid %d to", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1526 | status_code, aid); |
| 1527 | else |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1528 | pe_debug("*** Sending ReAssoc Resp status %d aid %d to", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1529 | status_code, aid); |
| 1530 | |
Abhishek Singh | 5d8d733 | 2017-08-10 15:15:24 +0530 | [diff] [blame] | 1531 | lim_print_mac_addr(mac_ctx, mac_hdr->da, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1532 | |
| 1533 | 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] | 1534 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1535 | &add_ie[0], addn_ie_len); |
| 1536 | |
Min Liu | 0daa098 | 2019-02-01 17:50:44 +0800 | [diff] [blame] | 1537 | if (sta && sta->mlmStaContext.owe_ie_len) |
| 1538 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload |
| 1539 | + addn_ie_len, |
| 1540 | sta->mlmStaContext.owe_ie, |
| 1541 | sta->mlmStaContext.owe_ie_len); |
| 1542 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 1543 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 1544 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 1545 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1546 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1547 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1548 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1549 | pe_session->peSessionId, mac_hdr->fc.subType)); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 1550 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1551 | pe_session, QDF_STATUS_SUCCESS, status_code); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1552 | /* Queue Association Response frame in high priority WQ */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1553 | if (tx_complete) |
| 1554 | qdf_status = wma_tx_frameWithTxComplete( |
| 1555 | mac_ctx, packet, (uint16_t)bytes, |
| 1556 | TXRX_FRM_802_11_MGMT, |
| 1557 | ANI_TXDIR_TODS, |
| 1558 | 7, lim_tx_complete, frame, |
| 1559 | lim_assoc_rsp_tx_complete, tx_flag, |
| 1560 | sme_session, false, 0, RATEID_DEFAULT); |
| 1561 | else |
| 1562 | qdf_status = wma_tx_frame( |
| 1563 | mac_ctx, packet, (uint16_t)bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1564 | TXRX_FRM_802_11_MGMT, |
| 1565 | ANI_TXDIR_TODS, |
| 1566 | 7, lim_tx_complete, frame, tx_flag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1567 | sme_session, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1568 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1569 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1570 | |
| 1571 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1572 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1573 | pe_err("Could not Send Re/AssocRsp, retCode=%X", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1574 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1575 | |
| 1576 | /* |
| 1577 | * update the ANI peer station count. |
| 1578 | * FIXME_PROTECTION : take care of different type of station |
| 1579 | * counter inside this function. |
| 1580 | */ |
| 1581 | lim_util_count_sta_add(mac_ctx, sta, pe_session); |
| 1582 | |
| 1583 | } |
| 1584 | |
| 1585 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1586 | lim_send_delts_req_action_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1587 | tSirMacAddr peer, |
| 1588 | uint8_t wmmTspecPresent, |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1589 | struct mac_ts_info *pTsinfo, |
Jeff Johnson | 56471b9 | 2018-12-22 14:36:06 -0800 | [diff] [blame] | 1590 | struct mac_tspec_ie *pTspecIe, |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1591 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1592 | { |
| 1593 | uint8_t *pFrame; |
| 1594 | tpSirMacMgmtHdr pMacHdr; |
| 1595 | tDot11fDelTS DelTS; |
| 1596 | tDot11fWMMDelTS WMMDelTS; |
| 1597 | uint32_t nBytes, nPayload, nStatus; |
| 1598 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1599 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1600 | uint8_t txFlag = 0; |
| 1601 | uint8_t smeSessionId = 0; |
| 1602 | |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1603 | if (!pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1604 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1605 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1606 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1607 | |
| 1608 | if (!wmmTspecPresent) { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1609 | qdf_mem_zero((uint8_t *) &DelTS, sizeof(DelTS)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1610 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 1611 | DelTS.Category.category = ACTION_CATEGORY_QOS; |
Srinivas Girigowda | 03cebc3 | 2019-05-17 16:50:31 -0700 | [diff] [blame] | 1612 | DelTS.Action.action = QOS_DEL_TS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1613 | populate_dot11f_ts_info(pTsinfo, &DelTS.TSInfo); |
| 1614 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1615 | nStatus = dot11f_get_packed_del_ts_size(mac, &DelTS, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1616 | if (DOT11F_FAILED(nStatus)) { |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1617 | pe_err("Failed to calculate the packed size for a Del TS (0x%08x)", |
| 1618 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1619 | /* We'll fall back on the worst case scenario: */ |
| 1620 | nPayload = sizeof(tDot11fDelTS); |
| 1621 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1622 | pe_warn("There were warnings while calculating the packed size for a Del TS (0x%08x)", |
| 1623 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1624 | } |
| 1625 | } else { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1626 | qdf_mem_zero((uint8_t *) &WMMDelTS, sizeof(WMMDelTS)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1627 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 1628 | WMMDelTS.Category.category = ACTION_CATEGORY_WMM; |
Srinivas Girigowda | 03cebc3 | 2019-05-17 16:50:31 -0700 | [diff] [blame] | 1629 | WMMDelTS.Action.action = QOS_DEL_TS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1630 | WMMDelTS.DialogToken.token = 0; |
| 1631 | WMMDelTS.StatusCode.statusCode = 0; |
| 1632 | populate_dot11f_wmmtspec(pTspecIe, &WMMDelTS.WMMTSPEC); |
| 1633 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1634 | dot11f_get_packed_wmm_del_ts_size(mac, &WMMDelTS, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1635 | if (DOT11F_FAILED(nStatus)) { |
Jeff Johnson | 312348f | 2018-12-22 13:33:54 -0800 | [diff] [blame] | 1636 | pe_err("Failed to calculate the packed size for a WMM Del TS (0x%08x)", |
| 1637 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1638 | /* We'll fall back on the worst case scenario: */ |
| 1639 | nPayload = sizeof(tDot11fDelTS); |
| 1640 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1641 | pe_warn("There were warnings while calculating the packed size for a WMM Del TS (0x%08x)", |
| 1642 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1643 | } |
| 1644 | } |
| 1645 | |
| 1646 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 1647 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1648 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1649 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 1650 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1651 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1652 | pe_err("Failed to allocate %d bytes for an Add TS Response", |
| 1653 | nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1654 | return; |
| 1655 | } |
| 1656 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1657 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1658 | |
| 1659 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1660 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 1661 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1662 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 1663 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1664 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1665 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1666 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1667 | |
| 1668 | /* That done, pack the struct: */ |
| 1669 | if (!wmmTspecPresent) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1670 | nStatus = dot11f_pack_del_ts(mac, &DelTS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1671 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1672 | nPayload, &nPayload); |
| 1673 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1674 | pe_err("Failed to pack a Del TS frame (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1675 | nStatus); |
| 1676 | cds_packet_free((void *)pPacket); |
| 1677 | return; /* allocated! */ |
| 1678 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1679 | pe_warn("There were warnings while packing a Del TS frame (0x%08x)", |
| 1680 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1681 | } |
| 1682 | } else { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1683 | nStatus = dot11f_pack_wmm_del_ts(mac, &WMMDelTS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1684 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1685 | nPayload, &nPayload); |
| 1686 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1687 | pe_err("Failed to pack a WMM Del TS frame (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1688 | nStatus); |
| 1689 | cds_packet_free((void *)pPacket); |
| 1690 | return; /* allocated! */ |
| 1691 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1692 | pe_warn("There were warnings while packing a WMM Del TS frame (0x%08x)", |
| 1693 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1694 | } |
| 1695 | } |
| 1696 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1697 | pe_debug("Sending DELTS REQ (size %d) to ", nBytes); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1698 | lim_print_mac_addr(mac, pMacHdr->da, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1699 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 1700 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 1701 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 1702 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1703 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1704 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1705 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1706 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1707 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1708 | pe_session, QDF_STATUS_SUCCESS, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1709 | QDF_STATUS_SUCCESS); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 1710 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1711 | TXRX_FRM_802_11_MGMT, |
| 1712 | ANI_TXDIR_TODS, |
| 1713 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1714 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1715 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1716 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1717 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1718 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1719 | pe_err("Failed to send Del TS (%X)!", qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1720 | |
| 1721 | } /* End lim_send_delts_req_action_frame. */ |
| 1722 | |
| 1723 | /** |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1724 | * lim_assoc_tx_complete_cnf()- Confirmation for assoc sent over the air |
| 1725 | * @context: pointer to global mac |
| 1726 | * @buf: buffer |
| 1727 | * @tx_complete : Sent status |
| 1728 | * @params; tx completion params |
| 1729 | * |
| 1730 | * Return: This returns QDF_STATUS |
| 1731 | */ |
| 1732 | |
| 1733 | static QDF_STATUS lim_assoc_tx_complete_cnf(void *context, |
| 1734 | qdf_nbuf_t buf, |
| 1735 | uint32_t tx_complete, |
| 1736 | void *params) |
| 1737 | { |
| 1738 | uint16_t assoc_ack_status; |
| 1739 | uint16_t reason_code; |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1740 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1741 | |
| 1742 | pe_debug("tx_complete= %d", tx_complete); |
Zhu Jianmin | 5d8e3fe | 2018-01-04 16:16:20 +0800 | [diff] [blame] | 1743 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) { |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1744 | assoc_ack_status = ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1745 | reason_code = QDF_STATUS_SUCCESS; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1746 | } else { |
| 1747 | assoc_ack_status = NOT_ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1748 | reason_code = QDF_STATUS_E_FAILURE; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1749 | } |
| 1750 | if (buf) |
| 1751 | qdf_nbuf_free(buf); |
| 1752 | |
| 1753 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_ACK_EVENT, |
| 1754 | NULL, assoc_ack_status, reason_code); |
| 1755 | return QDF_STATUS_SUCCESS; |
| 1756 | } |
| 1757 | |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 1758 | #ifdef WLAN_ADAPTIVE_11R |
| 1759 | /** |
| 1760 | * lim_fill_adaptive_11r_ie() - Populate the Vendor secific adaptive 11r |
| 1761 | * IE to association request frame |
| 1762 | * @pe_session: pointer to PE session |
| 1763 | * @ie_buf: buffer to which Adaptive 11r IE will be copied |
| 1764 | * @ie_len: length of the Adaptive 11r Vendor specific IE |
| 1765 | * |
| 1766 | * Return QDF_STATUS |
| 1767 | */ |
| 1768 | static QDF_STATUS lim_fill_adaptive_11r_ie(struct pe_session *pe_session, |
| 1769 | uint8_t **ie_buf, uint8_t *ie_len) |
| 1770 | { |
| 1771 | uint8_t *buf = NULL, *adaptive_11r_ie = NULL; |
| 1772 | |
| 1773 | if (!pe_session->is_adaptive_11r_connection) |
| 1774 | return QDF_STATUS_SUCCESS; |
| 1775 | |
| 1776 | /* |
| 1777 | * Vendor specific Adaptive 11r IE to be advertised in Assoc |
| 1778 | * req: |
| 1779 | * Type 0xDD |
| 1780 | * Length 0x0B |
| 1781 | * OUI 0x00 0x00 0x0F |
| 1782 | * Type 0x22 |
| 1783 | * subtype 0x00 |
| 1784 | * Version 0x01 |
| 1785 | * Length 0x04 |
| 1786 | * Data 0x00 00 00 01(0th bit is 1 means adaptive 11r is |
| 1787 | * supported) |
| 1788 | */ |
| 1789 | adaptive_11r_ie = qdf_mem_malloc(ADAPTIVE_11R_STA_IE_LEN + 2); |
| 1790 | if (!adaptive_11r_ie) |
| 1791 | return QDF_STATUS_E_FAILURE; |
| 1792 | |
| 1793 | /* Fill the Vendor IE Type (0xDD) */ |
| 1794 | buf = adaptive_11r_ie; |
Srinivas Girigowda | 8e7ecab | 2019-05-16 11:31:19 -0700 | [diff] [blame] | 1795 | *buf = WLAN_ELEMID_VENDOR; |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 1796 | buf++; |
| 1797 | |
| 1798 | /* Fill the Vendor IE length (0x0B) */ |
| 1799 | *buf = ADAPTIVE_11R_STA_IE_LEN; |
| 1800 | buf++; |
| 1801 | |
| 1802 | /* |
| 1803 | * Fill the Adaptive 11r Vendor specific OUI(0x00 0x00 0x0F 0x22) |
| 1804 | */ |
| 1805 | qdf_mem_copy(buf, ADAPTIVE_11R_STA_OUI, ADAPTIVE_11R_OUI_LEN); |
| 1806 | buf += ADAPTIVE_11R_OUI_LEN; |
| 1807 | |
| 1808 | /* Fill Adaptive 11r Vendor specific Subtype (0x00) */ |
| 1809 | *buf = ADAPTIVE_11R_OUI_SUBTYPE; |
| 1810 | buf++; |
| 1811 | |
| 1812 | /* Fill Adaptive 11r Version (0x01) */ |
| 1813 | *buf = ADAPTIVE_11R_OUI_VERSION; |
| 1814 | buf++; |
| 1815 | |
| 1816 | /* Fill Adaptive 11r IE Data length (0x04) */ |
| 1817 | *buf = ADAPTIVE_11R_DATA_LEN; |
| 1818 | buf++; |
| 1819 | |
| 1820 | /* Fill Adaptive 11r IE Data (0x00 0x00 0x00 0x01) */ |
| 1821 | qdf_mem_copy(buf, ADAPTIVE_11R_OUI_DATA, ADAPTIVE_11R_DATA_LEN); |
| 1822 | |
| 1823 | *ie_len = ADAPTIVE_11R_STA_IE_LEN + 2; |
| 1824 | *ie_buf = adaptive_11r_ie; |
| 1825 | |
| 1826 | return QDF_STATUS_SUCCESS; |
| 1827 | } |
| 1828 | |
| 1829 | #else |
| 1830 | static inline |
| 1831 | QDF_STATUS lim_fill_adaptive_11r_ie(struct pe_session *pe_session, |
| 1832 | uint8_t **ie_buf, uint8_t *ie_len) |
| 1833 | { |
| 1834 | return QDF_STATUS_SUCCESS; |
| 1835 | } |
| 1836 | #endif |
| 1837 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1838 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1839 | * lim_send_assoc_req_mgmt_frame() - Send association request |
| 1840 | * @mac_ctx: Handle to MAC context |
| 1841 | * @mlm_assoc_req: Association request information |
| 1842 | * @pe_session: PE session information |
| 1843 | * |
| 1844 | * Builds and transmits association request frame to AP. |
| 1845 | * |
| 1846 | * Return: Void |
| 1847 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1848 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1849 | lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1850 | tLimMlmAssocReq *mlm_assoc_req, |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 1851 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1852 | { |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 1853 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1854 | tDot11fAssocRequest *frm; |
| 1855 | uint16_t caps; |
Pragaspathi Thilagaraj | c051588 | 2019-10-24 02:59:11 +0530 | [diff] [blame] | 1856 | uint8_t *frame, *rsnx_ie = NULL; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1857 | QDF_STATUS sir_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1858 | tLimMlmAssocCnf assoc_cnf; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1859 | uint32_t bytes = 0, payload, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1860 | uint8_t qos_enabled, wme_enabled, wsm_enabled; |
| 1861 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1862 | QDF_STATUS qdf_status; |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 1863 | uint16_t add_ie_len, current_len = 0, vendor_ie_len = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1864 | uint8_t *add_ie; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 1865 | const uint8_t *wps_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1866 | uint8_t power_caps = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1867 | uint8_t tx_flag = 0; |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 1868 | uint8_t vdev_id = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1869 | bool vht_enabled = false; |
| 1870 | tDot11fIEExtCap extr_ext_cap; |
Pragaspathi Thilagaraj | 376ead9 | 2019-12-11 19:13:28 +0530 | [diff] [blame] | 1871 | bool extr_ext_flag = true, is_open_auth = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1872 | tpSirMacMgmtHdr mac_hdr; |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1873 | uint32_t ie_offset = 0; |
| 1874 | uint8_t *p_ext_cap = NULL; |
| 1875 | tDot11fIEExtCap bcn_ext_cap; |
| 1876 | uint8_t *bcn_ie = NULL; |
| 1877 | uint32_t bcn_ie_len = 0; |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 1878 | uint32_t aes_block_size_len = 0; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1879 | enum rateid min_rid = RATEID_DEFAULT; |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 1880 | uint8_t *mbo_ie = NULL, *adaptive_11r_ie = NULL, *vendor_ies = NULL; |
Pragaspathi Thilagaraj | c051588 | 2019-10-24 02:59:11 +0530 | [diff] [blame] | 1881 | uint8_t mbo_ie_len = 0, adaptive_11r_ie_len = 0, rsnx_ie_len = 0; |
Srinivas Dasari | 603d497 | 2019-09-20 17:28:44 +0530 | [diff] [blame] | 1882 | struct wlan_objmgr_peer *peer; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1883 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1884 | if (!pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1885 | pe_err("pe_session is NULL"); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1886 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1887 | return; |
| 1888 | } |
| 1889 | |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 1890 | vdev_id = pe_session->vdev_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1891 | |
| 1892 | /* check this early to avoid unncessary operation */ |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1893 | if (!pe_session->lim_join_req) { |
| 1894 | pe_err("pe_session->lim_join_req is NULL"); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1895 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1896 | return; |
| 1897 | } |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1898 | add_ie_len = pe_session->lim_join_req->addIEAssoc.length; |
| 1899 | add_ie = pe_session->lim_join_req->addIEAssoc.addIEdata; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1900 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1901 | frm = qdf_mem_malloc(sizeof(tDot11fAssocRequest)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1902 | if (!frm) { |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1903 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1904 | return; |
| 1905 | } |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1906 | qdf_mem_zero((uint8_t *) frm, sizeof(tDot11fAssocRequest)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1907 | |
Agrawal Ashish | 0f94b57 | 2016-02-22 13:27:06 +0530 | [diff] [blame] | 1908 | if (add_ie_len && pe_session->is_ext_caps_present) { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1909 | qdf_mem_zero((uint8_t *) &extr_ext_cap, |
| 1910 | sizeof(tDot11fIEExtCap)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1911 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 1912 | add_ie, &add_ie_len, &extr_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1913 | if (QDF_STATUS_SUCCESS != sir_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1914 | extr_ext_flag = false; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1915 | pe_debug("Unable to Stripoff ExtCap IE from Assoc Req"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1916 | } else { |
| 1917 | struct s_ext_cap *p_ext_cap = (struct s_ext_cap *) |
| 1918 | extr_ext_cap.bytes; |
| 1919 | |
| 1920 | if (p_ext_cap->interworking_service) |
| 1921 | p_ext_cap->qos_map = 1; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1922 | extr_ext_cap.num_bytes = |
| 1923 | lim_compute_ext_cap_ie_length(&extr_ext_cap); |
| 1924 | extr_ext_flag = (extr_ext_cap.num_bytes > 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1925 | } |
| 1926 | } else { |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 1927 | 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] | 1928 | extr_ext_flag = false; |
| 1929 | } |
| 1930 | |
| 1931 | caps = mlm_assoc_req->capabilityInfo; |
| 1932 | #if defined(FEATURE_WLAN_WAPI) |
| 1933 | /* |
| 1934 | * According to WAPI standard: |
| 1935 | * 7.3.1.4 Capability Information field |
| 1936 | * In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 |
| 1937 | * in transmitted Association or Reassociation management frames. |
| 1938 | * APs ignore the Privacy subfield within received Association and |
| 1939 | * Reassociation management frames. |
| 1940 | */ |
| 1941 | if (pe_session->encryptType == eSIR_ED_WPI) |
| 1942 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 1943 | #endif |
| 1944 | swap_bit_field16(caps, (uint16_t *) &frm->Capabilities); |
| 1945 | |
| 1946 | frm->ListenInterval.interval = mlm_assoc_req->listenInterval; |
| 1947 | populate_dot11f_ssid2(mac_ctx, &frm->SSID); |
| 1948 | populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1949 | &frm->SuppRates, pe_session); |
| 1950 | |
| 1951 | qos_enabled = (pe_session->limQosEnabled) && |
| 1952 | SIR_MAC_GET_QOS(pe_session->limCurrentBssCaps); |
| 1953 | |
| 1954 | wme_enabled = (pe_session->limWmeEnabled) && |
| 1955 | LIM_BSS_CAPS_GET(WME, pe_session->limCurrentBssQosCaps); |
| 1956 | |
| 1957 | /* We prefer .11e asociations: */ |
| 1958 | if (qos_enabled) |
| 1959 | wme_enabled = false; |
| 1960 | |
| 1961 | wsm_enabled = (pe_session->limWsmEnabled) && wme_enabled && |
| 1962 | LIM_BSS_CAPS_GET(WSM, pe_session->limCurrentBssQosCaps); |
| 1963 | |
| 1964 | if (pe_session->lim11hEnable && |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 1965 | pe_session->lim_join_req->spectrumMgtIndicator == true) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1966 | power_caps = true; |
| 1967 | |
| 1968 | populate_dot11f_power_caps(mac_ctx, &frm->PowerCaps, |
| 1969 | LIM_ASSOC, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1970 | populate_dot11f_supp_channels(mac_ctx, &frm->SuppChannels, |
| 1971 | LIM_ASSOC, pe_session); |
| 1972 | |
| 1973 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1974 | if (mac_ctx->rrm.rrmPEContext.rrmEnable && |
| 1975 | SIR_MAC_GET_RRM(pe_session->limCurrentBssCaps)) { |
| 1976 | if (power_caps == false) { |
| 1977 | power_caps = true; |
| 1978 | populate_dot11f_power_caps(mac_ctx, &frm->PowerCaps, |
| 1979 | LIM_ASSOC, pe_session); |
| 1980 | } |
| 1981 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1982 | if (qos_enabled) |
Naveen Rawat | cd11831 | 2016-11-22 10:46:21 -0800 | [diff] [blame] | 1983 | populate_dot11f_qos_caps_station(mac_ctx, pe_session, |
| 1984 | &frm->QOSCapsStation); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1985 | |
| 1986 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 1987 | POPULATE_DOT11F_RATES_OPERATIONAL, &frm->ExtSuppRates, |
| 1988 | pe_session); |
| 1989 | |
Gupta, Kapil | 54a1699 | 2016-01-13 19:34:02 +0530 | [diff] [blame] | 1990 | if (mac_ctx->rrm.rrmPEContext.rrmEnable && |
| 1991 | SIR_MAC_GET_RRM(pe_session->limCurrentBssCaps)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1992 | populate_dot11f_rrm_ie(mac_ctx, &frm->RRMEnabledCap, |
| 1993 | pe_session); |
Deepak Dhamdhere | 641bf32 | 2016-01-06 15:19:03 -0800 | [diff] [blame] | 1994 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1995 | /* |
| 1996 | * The join request *should* contain zero or one of the WPA and RSN |
| 1997 | * IEs. The payload send along with the request is a |
Jeff Johnson | 701444f | 2019-02-02 22:35:13 -0800 | [diff] [blame] | 1998 | * 'struct join_req'; the IE portion is held inside a 'tSirRSNie': |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1999 | * typedef struct sSirRSNie |
| 2000 | * { |
| 2001 | * uint16_t length; |
Srinivas Girigowda | cf16140 | 2019-03-14 11:37:33 -0700 | [diff] [blame] | 2002 | * uint8_t rsnIEdata[WLAN_MAX_IE_LEN+2]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2003 | * } tSirRSNie, *tpSirRSNie; |
| 2004 | * So, we should be able to make the following two calls harmlessly, |
| 2005 | * since they do nothing if they don't find the given IE in the |
| 2006 | * bytestream with which they're provided. |
| 2007 | * The net effect of this will be to faithfully transmit whatever |
| 2008 | * security IE is in the join request. |
| 2009 | * However, if we're associating for the purpose of WPS |
| 2010 | * enrollment, and we've been configured to indicate that by |
| 2011 | * eliding the WPA or RSN IE, we just skip this: |
| 2012 | */ |
| 2013 | if (add_ie_len && add_ie) |
| 2014 | wps_ie = limGetWscIEPtr(mac_ctx, add_ie, add_ie_len); |
| 2015 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2016 | if (!wps_ie) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2017 | populate_dot11f_rsn_opaque(mac_ctx, |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2018 | &pe_session->lim_join_req->rsnIE, |
| 2019 | &frm->RSNOpaque); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2020 | populate_dot11f_wpa_opaque(mac_ctx, |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2021 | &pe_session->lim_join_req->rsnIE, |
| 2022 | &frm->WPAOpaque); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2023 | #if defined(FEATURE_WLAN_WAPI) |
| 2024 | populate_dot11f_wapi_opaque(mac_ctx, |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2025 | &(pe_session->lim_join_req->rsnIE), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2026 | &frm->WAPIOpaque); |
| 2027 | #endif /* defined(FEATURE_WLAN_WAPI) */ |
| 2028 | } |
| 2029 | /* include WME EDCA IE as well */ |
| 2030 | if (wme_enabled) { |
| 2031 | populate_dot11f_wmm_info_station_per_session(mac_ctx, |
| 2032 | pe_session, &frm->WMMInfoStation); |
| 2033 | |
| 2034 | if (wsm_enabled) |
| 2035 | populate_dot11f_wmm_caps(&frm->WMMCaps); |
| 2036 | } |
| 2037 | |
| 2038 | /* |
| 2039 | * Populate HT IEs, when operating in 11n and |
| 2040 | * when AP is also operating in 11n mode |
| 2041 | */ |
| 2042 | if (pe_session->htCapability && |
| 2043 | mac_ctx->lim.htCapabilityPresentInBeacon) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2044 | pe_debug("Populate HT Caps in Assoc Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2045 | populate_dot11f_ht_caps(mac_ctx, pe_session, &frm->HTCaps); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 2046 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 2047 | &frm->HTCaps, sizeof(frm->HTCaps)); |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 2048 | } else if (pe_session->he_with_wep_tkip) { |
| 2049 | pe_debug("Populate HT Caps in Assoc Request with WEP/TKIP"); |
| 2050 | populate_dot11f_ht_caps(mac_ctx, NULL, &frm->HTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2051 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2052 | 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] | 2053 | frm->HTCaps.supportedChannelWidthSet, |
| 2054 | frm->HTCaps.mimoPowerSave, |
| 2055 | frm->HTCaps.greenField, frm->HTCaps.shortGI20MHz, |
| 2056 | frm->HTCaps.shortGI40MHz, |
| 2057 | frm->HTCaps.dsssCckMode40MHz, |
| 2058 | frm->HTCaps.maxRxAMPDUFactor); |
| 2059 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2060 | if (pe_session->vhtCapability && |
| 2061 | pe_session->vhtCapabilityPresentInBeacon) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2062 | pe_debug("Populate VHT IEs in Assoc Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2063 | populate_dot11f_vht_caps(mac_ctx, pe_session, &frm->VHTCaps); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 2064 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 2065 | &frm->VHTCaps, sizeof(frm->VHTCaps)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2066 | vht_enabled = true; |
Kiran Kumar Lokere | 1d4094e | 2016-08-31 19:04:04 -0700 | [diff] [blame] | 2067 | if (pe_session->enableHtSmps && |
| 2068 | !pe_session->supported_nss_1x1) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2069 | pe_err("VHT OP mode IE in Assoc Req"); |
Kiran Kumar Lokere | 1d4094e | 2016-08-31 19:04:04 -0700 | [diff] [blame] | 2070 | populate_dot11f_operating_mode(mac_ctx, |
| 2071 | &frm->OperatingMode, pe_session); |
| 2072 | } |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 2073 | } else if (pe_session->he_with_wep_tkip) { |
| 2074 | pe_debug("Populate VHT IEs in Assoc Request with WEP/TKIP"); |
| 2075 | populate_dot11f_vht_caps(mac_ctx, NULL, &frm->VHTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2076 | } |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 2077 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2078 | if (!vht_enabled && |
| 2079 | pe_session->is_vendor_specific_vhtcaps) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2080 | pe_debug("Populate Vendor VHT IEs in Assoc Request"); |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 2081 | frm->vendor_vht_ie.present = 1; |
Kiran Kumar Lokere | 8172263 | 2017-09-26 12:11:43 -0700 | [diff] [blame] | 2082 | frm->vendor_vht_ie.sub_type = |
| 2083 | pe_session->vendor_specific_vht_ie_sub_type; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 2084 | frm->vendor_vht_ie.VHTCaps.present = 1; |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 2085 | if (!mac_ctx->mlme_cfg->vht_caps.vht_cap_info.vendor_vhtie && |
Abhishek Singh | 6884428 | 2018-01-25 16:48:41 +0530 | [diff] [blame] | 2086 | pe_session->vht_config.su_beam_formee) { |
| 2087 | pe_debug("Disable SU beamformee for vendor IE"); |
| 2088 | pe_session->vht_config.su_beam_formee = 0; |
| 2089 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2090 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 2091 | &frm->vendor_vht_ie.VHTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2092 | vht_enabled = true; |
| 2093 | } |
Agrawal Ashish | 0f94b57 | 2016-02-22 13:27:06 +0530 | [diff] [blame] | 2094 | if (pe_session->is_ext_caps_present) |
| 2095 | populate_dot11f_ext_cap(mac_ctx, vht_enabled, |
| 2096 | &frm->ExtCap, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2097 | |
Kiran Kumar Lokere | 89f01f0 | 2019-08-06 18:22:39 -0700 | [diff] [blame] | 2098 | populate_dot11f_qcn_ie(mac_ctx, &frm->qcn_ie, QCN_IE_ATTR_ID_ALL); |
Selvaraj, Sridhar | a521aab | 2017-03-25 16:42:34 +0530 | [diff] [blame] | 2099 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2100 | if (lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 2101 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2102 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 2103 | &frm->he_cap); |
Manikandan Mohan | 8e4491c | 2019-10-23 16:00:51 -0700 | [diff] [blame] | 2104 | populate_dot11f_he_6ghz_cap(mac_ctx, pe_session, |
| 2105 | &frm->he_6ghz_band_cap); |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 2106 | } else if (pe_session->he_with_wep_tkip) { |
| 2107 | pe_debug("Populate HE IEs in Assoc Request with WEP/TKIP"); |
| 2108 | populate_dot11f_he_caps(mac_ctx, NULL, &frm->he_cap); |
Manikandan Mohan | 8e4491c | 2019-10-23 16:00:51 -0700 | [diff] [blame] | 2109 | populate_dot11f_he_6ghz_cap(mac_ctx, pe_session, |
| 2110 | &frm->he_6ghz_band_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2111 | } |
Selvaraj, Sridhar | c2fe7a3 | 2017-02-02 19:20:16 +0530 | [diff] [blame] | 2112 | |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2113 | if (pe_session->lim_join_req->is11Rconnection) { |
Pragaspathi Thilagaraj | 1112c96 | 2019-05-23 23:45:38 +0530 | [diff] [blame] | 2114 | struct bss_description *bssdescr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2115 | |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2116 | bssdescr = &pe_session->lim_join_req->bssDescription; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2117 | pe_debug("mdie = %02x %02x %02x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2118 | (unsigned int) bssdescr->mdie[0], |
| 2119 | (unsigned int) bssdescr->mdie[1], |
| 2120 | (unsigned int) bssdescr->mdie[2]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2121 | populate_mdie(mac_ctx, &frm->MobilityDomain, |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2122 | pe_session->lim_join_req->bssDescription.mdie); |
Pragaspathi Thilagaraj | 03839b9 | 2019-03-12 17:45:21 +0530 | [diff] [blame] | 2123 | |
| 2124 | /* |
| 2125 | * IEEE80211-ai [13.2.4 FT initial mobility domain association |
| 2126 | * over FILS in an RSN] |
| 2127 | * Populate FT IE in association request. This FT IE should be |
| 2128 | * same as the FT IE received in auth response frame during the |
| 2129 | * FT-FILS authentication. |
| 2130 | */ |
| 2131 | if (lim_is_fils_connection(pe_session)) |
| 2132 | populate_fils_ft_info(mac_ctx, &frm->FTInfo, |
| 2133 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2134 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2135 | |
| 2136 | #ifdef FEATURE_WLAN_ESE |
| 2137 | /* |
| 2138 | * ESE Version IE will be included in association request |
| 2139 | * when ESE is enabled on DUT through ini and it is also |
| 2140 | * advertised by the peer AP to which we are trying to |
| 2141 | * associate to. |
| 2142 | */ |
| 2143 | if (pe_session->is_ese_version_ie_present && |
Wu Gao | 51a6356 | 2018-11-08 16:29:10 +0800 | [diff] [blame] | 2144 | mac_ctx->mlme_cfg->lfr.ese_enabled) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2145 | populate_dot11f_ese_version(&frm->ESEVersion); |
| 2146 | /* For ESE Associations fill the ESE IEs */ |
| 2147 | if (pe_session->isESEconnection && |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2148 | pe_session->lim_join_req->isESEFeatureIniEnabled) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2149 | #ifndef FEATURE_DISABLE_RM |
| 2150 | populate_dot11f_ese_rad_mgmt_cap(&frm->ESERadMgmtCap); |
| 2151 | #endif |
| 2152 | } |
| 2153 | #endif |
| 2154 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 2155 | /* |
| 2156 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 2157 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 2158 | * dot11f get packed payload size. |
| 2159 | */ |
| 2160 | if (extr_ext_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 2161 | lim_merge_extcap_struct(&frm->ExtCap, &extr_ext_cap, true); |
| 2162 | |
| 2163 | /* Clear the bits in EXTCAP IE if AP not advertise it in beacon */ |
| 2164 | if (frm->ExtCap.present && pe_session->is_ext_caps_present) { |
| 2165 | ie_offset = DOT11F_FF_TIMESTAMP_LEN + |
| 2166 | DOT11F_FF_BEACONINTERVAL_LEN + |
| 2167 | DOT11F_FF_CAPABILITIES_LEN; |
| 2168 | |
| 2169 | qdf_mem_zero((uint8_t *)&bcn_ext_cap, sizeof(tDot11fIEExtCap)); |
| 2170 | if (pe_session->beacon && pe_session->bcnLen > ie_offset) { |
| 2171 | bcn_ie = pe_session->beacon + ie_offset; |
| 2172 | bcn_ie_len = pe_session->bcnLen - ie_offset; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 2173 | p_ext_cap = (uint8_t *)wlan_get_ie_ptr_from_eid( |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 2174 | DOT11F_EID_EXTCAP, |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 2175 | bcn_ie, bcn_ie_len); |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 2176 | lim_update_extcap_struct(mac_ctx, p_ext_cap, |
| 2177 | &bcn_ext_cap); |
| 2178 | lim_merge_extcap_struct(&frm->ExtCap, &bcn_ext_cap, |
| 2179 | false); |
| 2180 | } |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 2181 | /* |
| 2182 | * TWT extended capabilities should be populated after the |
| 2183 | * intersection of beacon caps and self caps is done because |
| 2184 | * the bits for TWT are unique to STA and AP and cannot be |
| 2185 | * intersected. |
| 2186 | */ |
| 2187 | populate_dot11f_twt_extended_caps(mac_ctx, pe_session, |
| 2188 | &frm->ExtCap); |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 2189 | } |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 2190 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2191 | 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] | 2192 | add_ie, &add_ie_len, &frm->SuppOperatingClasses)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2193 | pe_debug("Unable to Stripoff supp op classes IE from Assoc Req"); |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 2194 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2195 | if (lim_is_fils_connection(pe_session)) { |
| 2196 | populate_dot11f_fils_params(mac_ctx, frm, pe_session); |
| 2197 | aes_block_size_len = AES_BLOCK_SIZE; |
| 2198 | } |
| 2199 | |
Pragaspathi Thilagaraj | c051588 | 2019-10-24 02:59:11 +0530 | [diff] [blame] | 2200 | /* RSNX IE for SAE PWE derivation based on H2E */ |
| 2201 | if (wlan_get_ie_ptr_from_eid(WLAN_ELEMID_RSNXE, add_ie, add_ie_len)) { |
| 2202 | rsnx_ie = qdf_mem_malloc(WLAN_MAX_IE_LEN + 2); |
| 2203 | if (!rsnx_ie) |
| 2204 | goto end; |
| 2205 | |
| 2206 | qdf_status = lim_strip_ie(mac_ctx, add_ie, &add_ie_len, |
| 2207 | WLAN_ELEMID_RSNXE, ONE_BYTE, |
| 2208 | NULL, 0, rsnx_ie, WLAN_MAX_IE_LEN); |
| 2209 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2210 | pe_err("Failed to strip Vendor IEs"); |
| 2211 | goto end; |
| 2212 | } |
| 2213 | rsnx_ie_len = rsnx_ie[1] + 2; |
| 2214 | pe_debug("RSNX_IE added to association request"); |
| 2215 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 2216 | rsnx_ie, rsnx_ie_len); |
| 2217 | } |
| 2218 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2219 | /* |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2220 | * MBO IE needs to be appendded at the end of the assoc request |
| 2221 | * frame and is not parsed and unpacked by the frame parser |
| 2222 | * as the supplicant can send multiple TLVs with same Attribute |
| 2223 | * in the MBO IE and the frame parser does not support multiple |
| 2224 | * TLVs with same attribute in a single IE. |
| 2225 | * Strip off the MBO IE from add_ie and append it at the end. |
| 2226 | */ |
| 2227 | if (wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_MBO_OUI, |
| 2228 | SIR_MAC_MBO_OUI_SIZE, add_ie, add_ie_len)) { |
| 2229 | mbo_ie = qdf_mem_malloc(DOT11F_IE_MBO_IE_MAX_LEN + 2); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2230 | if (!mbo_ie) |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2231 | goto end; |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2232 | |
| 2233 | qdf_status = lim_strip_ie(mac_ctx, add_ie, &add_ie_len, |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 2234 | WLAN_ELEMID_VENDOR, ONE_BYTE, |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2235 | SIR_MAC_MBO_OUI, |
| 2236 | SIR_MAC_MBO_OUI_SIZE, |
| 2237 | mbo_ie, DOT11F_IE_MBO_IE_MAX_LEN); |
| 2238 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2239 | pe_err("Failed to strip MBO IE"); |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 2240 | goto end; |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2241 | } |
| 2242 | |
| 2243 | /* Include the EID and length fields */ |
| 2244 | mbo_ie_len = mbo_ie[1] + 2; |
Srinivas Dasari | 603d497 | 2019-09-20 17:28:44 +0530 | [diff] [blame] | 2245 | |
Pragaspathi Thilagaraj | 376ead9 | 2019-12-11 19:13:28 +0530 | [diff] [blame] | 2246 | if (pe_session->connected_akm == ANI_AKM_TYPE_NONE) |
| 2247 | is_open_auth = true; |
| 2248 | |
| 2249 | pe_debug("Stripped MBO IE of length %d is_open_auth:%d", |
| 2250 | mbo_ie_len, is_open_auth); |
| 2251 | |
| 2252 | if (!is_open_auth) { |
| 2253 | peer = wlan_objmgr_get_peer_by_mac( |
| 2254 | mac_ctx->psoc, |
| 2255 | mlm_assoc_req->peerMacAddr, |
| 2256 | WLAN_MBO_ID); |
| 2257 | if (peer && !mlme_get_peer_pmf_status(peer)) { |
| 2258 | pe_debug("Peer doesn't support PMF, Don't add MBO IE"); |
| 2259 | qdf_mem_free(mbo_ie); |
| 2260 | mbo_ie = NULL; |
| 2261 | mbo_ie_len = 0; |
| 2262 | } |
| 2263 | if (peer) |
| 2264 | wlan_objmgr_peer_release_ref(peer, WLAN_MBO_ID); |
Srinivas Dasari | 603d497 | 2019-09-20 17:28:44 +0530 | [diff] [blame] | 2265 | } |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2266 | } |
| 2267 | |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 2268 | /* |
| 2269 | * Strip rest of the vendor IEs and append to the assoc request frame. |
| 2270 | * Append the IEs just before MBO IEs as MBO IEs have to be at the |
| 2271 | * end of the frame. |
| 2272 | */ |
| 2273 | if (wlan_get_ie_ptr_from_eid(WLAN_ELEMID_VENDOR, add_ie, add_ie_len)) { |
| 2274 | vendor_ies = qdf_mem_malloc(MAX_VENDOR_IES_LEN + 2); |
| 2275 | if (vendor_ies) { |
| 2276 | current_len = add_ie_len; |
| 2277 | qdf_status = lim_strip_ie(mac_ctx, add_ie, &add_ie_len, |
| 2278 | WLAN_ELEMID_VENDOR, ONE_BYTE, |
| 2279 | NULL, |
| 2280 | 0, |
| 2281 | vendor_ies, |
| 2282 | MAX_VENDOR_IES_LEN); |
| 2283 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2284 | pe_err("Failed to strip Vendor IEs"); |
| 2285 | goto end; |
| 2286 | } |
| 2287 | |
| 2288 | vendor_ie_len = current_len - add_ie_len; |
| 2289 | pe_debug("Stripped vendor IEs of size: %u", |
| 2290 | current_len); |
| 2291 | } |
| 2292 | } |
| 2293 | |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 2294 | qdf_status = lim_fill_adaptive_11r_ie(pe_session, &adaptive_11r_ie, |
| 2295 | &adaptive_11r_ie_len); |
| 2296 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2297 | pe_err("Failed to fill adaptive 11r IE"); |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 2298 | goto end; |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 2299 | } |
| 2300 | |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2301 | /* |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2302 | * Do unpack to populate the add_ie buffer to frm structure |
| 2303 | * before packing the frm structure. In this way, the IE ordering |
| 2304 | * which the latest 802.11 spec mandates is maintained. |
| 2305 | */ |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 2306 | if (add_ie_len) { |
| 2307 | ret = dot11f_unpack_assoc_request(mac_ctx, add_ie, |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2308 | add_ie_len, frm, true); |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 2309 | if (DOT11F_FAILED(ret)) { |
| 2310 | pe_err("unpack failed, ret: 0x%x", ret); |
| 2311 | goto end; |
| 2312 | } |
| 2313 | } |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2314 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2315 | status = dot11f_get_packed_assoc_request_size(mac_ctx, frm, &payload); |
| 2316 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2317 | pe_err("Association Request packet size failure(0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2318 | status); |
| 2319 | /* We'll fall back on the worst case scenario: */ |
| 2320 | payload = sizeof(tDot11fAssocRequest); |
| 2321 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2322 | pe_warn("Association request packet size warning (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2323 | status); |
| 2324 | } |
| 2325 | |
Pragaspathi Thilagaraj | c051588 | 2019-10-24 02:59:11 +0530 | [diff] [blame] | 2326 | bytes = payload + sizeof(tSirMacMgmtHdr) + aes_block_size_len + |
| 2327 | rsnx_ie_len + mbo_ie_len + adaptive_11r_ie_len + vendor_ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2328 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2329 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2330 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2331 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2332 | pe_err("Failed to allocate %d bytes", bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2333 | |
| 2334 | pe_session->limMlmState = pe_session->limPrevMlmState; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2335 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_MLM_STATE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2336 | pe_session->peSessionId, |
| 2337 | pe_session->limMlmState)); |
| 2338 | |
| 2339 | /* Update PE session id */ |
| 2340 | assoc_cnf.sessionId = pe_session->peSessionId; |
| 2341 | |
| 2342 | assoc_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2343 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2344 | lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_CNF, |
| 2345 | (uint32_t *) &assoc_cnf); |
| 2346 | |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2347 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2348 | } |
| 2349 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 2350 | qdf_mem_zero(frame, bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2351 | |
| 2352 | /* Next, we fill out the buffer descriptor: */ |
| 2353 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 2354 | SIR_MAC_MGMT_ASSOC_REQ, pe_session->bssId, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 2355 | pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2356 | /* That done, pack the Assoc Request: */ |
| 2357 | status = dot11f_pack_assoc_request(mac_ctx, frm, |
| 2358 | frame + sizeof(tSirMacMgmtHdr), payload, &payload); |
| 2359 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2360 | pe_err("Assoc request pack failure (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2361 | cds_packet_free((void *)packet); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2362 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2363 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2364 | pe_warn("Assoc request pack warning (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2365 | } |
| 2366 | |
Pragaspathi Thilagaraj | c051588 | 2019-10-24 02:59:11 +0530 | [diff] [blame] | 2367 | if (rsnx_ie && rsnx_ie_len) { |
| 2368 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
| 2369 | rsnx_ie, rsnx_ie_len); |
| 2370 | payload = payload + rsnx_ie_len; |
| 2371 | } |
| 2372 | |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 2373 | /* Copy the vendor IEs to the end of the frame */ |
| 2374 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
| 2375 | vendor_ies, vendor_ie_len); |
| 2376 | payload = payload + vendor_ie_len; |
| 2377 | |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2378 | /* Copy the MBO IE to the end of the frame */ |
| 2379 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
| 2380 | mbo_ie, mbo_ie_len); |
| 2381 | payload = payload + mbo_ie_len; |
| 2382 | |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 2383 | /* |
| 2384 | * Copy the Vendor specific Adaptive 11r IE to end of the |
| 2385 | * assoc request frame |
| 2386 | */ |
| 2387 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
| 2388 | adaptive_11r_ie, adaptive_11r_ie_len); |
| 2389 | payload = payload + adaptive_11r_ie_len; |
| 2390 | |
Pragaspathi Thilagaraj | f812ccf | 2019-06-22 13:07:04 +0530 | [diff] [blame] | 2391 | if (pe_session->assoc_req) { |
| 2392 | qdf_mem_free(pe_session->assoc_req); |
| 2393 | pe_session->assoc_req = NULL; |
Naveen Rawat | 83102ef | 2015-11-03 10:42:34 -0800 | [diff] [blame] | 2394 | pe_session->assocReqLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2395 | } |
| 2396 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2397 | if (lim_is_fils_connection(pe_session)) { |
| 2398 | qdf_status = aead_encrypt_assoc_req(mac_ctx, pe_session, |
| 2399 | frame, &payload); |
| 2400 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 2401 | cds_packet_free((void *)packet); |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 2402 | goto end; |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2403 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2404 | } |
| 2405 | |
Pragaspathi Thilagaraj | f812ccf | 2019-06-22 13:07:04 +0530 | [diff] [blame] | 2406 | pe_session->assoc_req = qdf_mem_malloc(payload); |
| 2407 | if (pe_session->assoc_req) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2408 | /* |
| 2409 | * Store the Assoc request. This is sent to csr/hdd in |
| 2410 | * join cnf response. |
| 2411 | */ |
Pragaspathi Thilagaraj | f812ccf | 2019-06-22 13:07:04 +0530 | [diff] [blame] | 2412 | qdf_mem_copy(pe_session->assoc_req, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2413 | frame + sizeof(tSirMacMgmtHdr), payload); |
| 2414 | pe_session->assocReqLen = payload; |
| 2415 | } |
| 2416 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 2417 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 2418 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 2419 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2420 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2421 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 2422 | if (pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 2423 | pe_session->opmode == QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2424 | tx_flag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2425 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2426 | mac_hdr = (tpSirMacMgmtHdr) frame; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2427 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2428 | pe_session->peSessionId, mac_hdr->fc.subType)); |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2429 | |
| 2430 | pe_debug("Sending Association Request length %d to ", bytes); |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2431 | min_rid = lim_get_min_session_txrate(pe_session); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2432 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_START_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2433 | pe_session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2434 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2435 | pe_session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2436 | qdf_status = |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2437 | wma_tx_frameWithTxComplete(mac_ctx, packet, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2438 | (uint16_t) (sizeof(tSirMacMgmtHdr) + payload), |
| 2439 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2440 | lim_tx_complete, frame, lim_assoc_tx_complete_cnf, |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 2441 | tx_flag, vdev_id, false, 0, min_rid); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2442 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2443 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2444 | pe_session->peSessionId, qdf_status)); |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2445 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2446 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2447 | pe_err("Failed to send Association Request (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2448 | qdf_status); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2449 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2450 | pe_session, SENT_FAIL, QDF_STATUS_E_FAILURE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2451 | /* Pkt will be freed up by the callback */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2452 | } |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2453 | |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2454 | end: |
Pragaspathi Thilagaraj | c051588 | 2019-10-24 02:59:11 +0530 | [diff] [blame] | 2455 | qdf_mem_free(rsnx_ie); |
Srinivas Dasari | 2239790 | 2019-07-29 21:34:10 +0530 | [diff] [blame] | 2456 | qdf_mem_free(vendor_ies); |
| 2457 | qdf_mem_free(mbo_ie); |
| 2458 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2459 | /* Free up buffer allocated for mlm_assoc_req */ |
Pragaspathi Thilagaraj | 54018e0 | 2019-04-25 01:32:17 +0530 | [diff] [blame] | 2460 | qdf_mem_free(adaptive_11r_ie); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2461 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2462 | mlm_assoc_req = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2463 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2464 | return; |
| 2465 | } |
| 2466 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2467 | /** |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 2468 | * lim_addba_rsp_tx_complete_cnf() - Confirmation for add BA response OTA |
| 2469 | * @context: pointer to global mac |
| 2470 | * @buf: buffer which is nothing but entire ADD BA frame |
| 2471 | * @tx_complete : Sent status |
| 2472 | * @params; tx completion params |
| 2473 | * |
| 2474 | * Return: This returns QDF_STATUS |
| 2475 | */ |
| 2476 | static QDF_STATUS lim_addba_rsp_tx_complete_cnf(void *context, |
| 2477 | qdf_nbuf_t buf, |
| 2478 | uint32_t tx_complete, |
| 2479 | void *params) |
| 2480 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2481 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 2482 | tSirMacMgmtHdr *mac_hdr; |
| 2483 | tDot11faddba_rsp rsp; |
| 2484 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 2485 | uint32_t frame_len; |
| 2486 | QDF_STATUS status; |
| 2487 | uint8_t *data; |
Vevek Venkatesan | 0ac759f | 2019-10-03 04:14:29 +0530 | [diff] [blame] | 2488 | struct wmi_mgmt_params *mgmt_params = (struct wmi_mgmt_params *)params; |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 2489 | |
| 2490 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) |
| 2491 | pe_debug("Add ba response successfully sent"); |
| 2492 | else |
| 2493 | pe_debug("Fail to send add ba response"); |
| 2494 | |
| 2495 | if (!buf) { |
| 2496 | pe_err("Addba response frame buffer is NULL"); |
| 2497 | return QDF_STATUS_E_FAILURE; |
| 2498 | } |
| 2499 | |
| 2500 | data = qdf_nbuf_data(buf); |
| 2501 | |
| 2502 | if (!data) { |
| 2503 | pe_err("Addba response frame is NULL"); |
| 2504 | return QDF_STATUS_E_FAILURE; |
| 2505 | } |
| 2506 | |
| 2507 | mac_hdr = (tSirMacMgmtHdr *)data; |
| 2508 | qdf_mem_zero((void *)&rsp, sizeof(tDot11faddba_rsp)); |
| 2509 | frame_len = sizeof(rsp); |
| 2510 | status = dot11f_unpack_addba_rsp(mac_ctx, (uint8_t *)data + |
| 2511 | sizeof(*mac_hdr), frame_len, |
| 2512 | &rsp, false); |
| 2513 | |
| 2514 | if (DOT11F_FAILED(status)) { |
| 2515 | pe_err("Failed to unpack and parse (0x%08x, %d bytes)", |
| 2516 | status, frame_len); |
| 2517 | goto error; |
| 2518 | } |
| 2519 | |
Vevek Venkatesan | 0ac759f | 2019-10-03 04:14:29 +0530 | [diff] [blame] | 2520 | cdp_addba_resp_tx_completion(soc, mac_hdr->da, mgmt_params->vdev_id, |
| 2521 | rsp.addba_param_set.tid, tx_complete); |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 2522 | error: |
| 2523 | if (buf) |
| 2524 | qdf_nbuf_free(buf); |
| 2525 | |
| 2526 | return QDF_STATUS_SUCCESS; |
| 2527 | } |
| 2528 | |
| 2529 | /** |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2530 | * lim_auth_tx_complete_cnf()- Confirmation for auth sent over the air |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2531 | * @context: pointer to global mac |
| 2532 | * @buf: buffer |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2533 | * @tx_complete : Sent status |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2534 | * @params; tx completion params |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2535 | * |
| 2536 | * Return: This returns QDF_STATUS |
| 2537 | */ |
| 2538 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2539 | static QDF_STATUS lim_auth_tx_complete_cnf(void *context, |
| 2540 | qdf_nbuf_t buf, |
| 2541 | uint32_t tx_complete, |
| 2542 | void *params) |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2543 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2544 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2545 | uint16_t auth_ack_status; |
| 2546 | uint16_t reason_code; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2547 | |
Naveen Rawat | 684e8b1 | 2017-09-20 15:54:44 -0700 | [diff] [blame] | 2548 | pe_debug("tx_complete = %d %s", tx_complete, |
Zhu Jianmin | 5d8e3fe | 2018-01-04 16:16:20 +0800 | [diff] [blame] | 2549 | (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) ? |
| 2550 | "success" : "fail"); |
| 2551 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) { |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2552 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_SUCCESS; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2553 | auth_ack_status = ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2554 | reason_code = QDF_STATUS_SUCCESS; |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2555 | /* 'Change' timer for future activations */ |
| 2556 | lim_deactivate_and_change_timer(mac_ctx, eLIM_AUTH_RETRY_TIMER); |
| 2557 | } else { |
| 2558 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2559 | auth_ack_status = NOT_ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2560 | reason_code = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2561 | } |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2562 | |
| 2563 | if (buf) |
| 2564 | qdf_nbuf_free(buf); |
| 2565 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2566 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
| 2567 | NULL, auth_ack_status, reason_code); |
| 2568 | |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2569 | return QDF_STATUS_SUCCESS; |
| 2570 | } |
| 2571 | |
| 2572 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2573 | * lim_send_auth_mgmt_frame() - Send an Authentication frame |
| 2574 | * |
| 2575 | * @mac_ctx: Pointer to Global MAC structure |
| 2576 | * @auth_frame: Pointer to Authentication frame structure |
| 2577 | * @peer_addr: MAC address of destination peer |
| 2578 | * @wep_bit: wep bit in frame control for Authentication frame3 |
| 2579 | * @session: PE session information |
| 2580 | * |
| 2581 | * This function is called by lim_process_mlm_messages(). Authentication frame |
| 2582 | * is formatted and sent when this function is called. |
| 2583 | * |
| 2584 | * Return: void |
| 2585 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2586 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2587 | lim_send_auth_mgmt_frame(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2588 | tpSirMacAuthFrameBody auth_frame, |
| 2589 | tSirMacAddr peer_addr, |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2590 | uint8_t wep_challenge_len, |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 2591 | struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2592 | { |
| 2593 | uint8_t *frame, *body; |
| 2594 | uint32_t frame_len = 0, body_len = 0; |
| 2595 | tpSirMacMgmtHdr mac_hdr; |
| 2596 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2597 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2598 | uint8_t tx_flag = 0; |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 2599 | uint8_t vdev_id = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2600 | uint16_t ft_ies_length = 0; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2601 | bool challenge_req = false; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2602 | enum rateid min_rid = RATEID_DEFAULT; |
Rajasekaran Kalidoss | 7152a35 | 2018-11-19 09:58:35 +0530 | [diff] [blame] | 2603 | uint16_t ch_freq_tx_frame = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2604 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2605 | if (!session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2606 | pe_err("Error: psession Entry is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2607 | return; |
| 2608 | } |
| 2609 | |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 2610 | vdev_id = session->vdev_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2611 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2612 | if (wep_challenge_len) { |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2613 | /* |
| 2614 | * Auth frame3 to be sent with encrypted framebody |
| 2615 | * |
| 2616 | * Allocate buffer for Authenticaton frame of size |
| 2617 | * equal to management frame header length plus 2 bytes |
| 2618 | * each for auth algorithm number, transaction number, |
| 2619 | * status code, 128 bytes for challenge text and |
| 2620 | * 4 bytes each for IV & ICV. |
| 2621 | */ |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2622 | pe_debug("Sending encrypted auth frame to " QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2623 | QDF_MAC_ADDR_ARRAY(peer_addr)); |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2624 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2625 | body_len = wep_challenge_len + LIM_ENCR_AUTH_INFO_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2626 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2627 | |
| 2628 | goto alloc_packet; |
| 2629 | } |
| 2630 | |
Tushnim Bhattacharyya | 332b74c | 2018-08-10 10:55:51 -0700 | [diff] [blame] | 2631 | pe_debug("Sending Auth seq# %d status %d (%d) to " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2632 | QDF_MAC_ADDR_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2633 | auth_frame->authTransactionSeqNumber, |
| 2634 | auth_frame->authStatusCode, |
| 2635 | (auth_frame->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2636 | QDF_MAC_ADDR_ARRAY(peer_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2637 | |
| 2638 | switch (auth_frame->authTransactionSeqNumber) { |
| 2639 | case SIR_MAC_AUTH_FRAME_1: |
| 2640 | /* |
| 2641 | * Allocate buffer for Authenticaton frame of size |
| 2642 | * equal to management frame header length plus 2 bytes |
| 2643 | * each for auth algorithm number, transaction number |
| 2644 | * and status code. |
| 2645 | */ |
| 2646 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2647 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2648 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2649 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2650 | frame_len += lim_create_fils_auth_data(mac_ctx, |
| 2651 | auth_frame, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2652 | if (auth_frame->authAlgoNumber == eSIR_FT_AUTH) { |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2653 | if (session->ftPEContext.pFTPreAuthReq && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2654 | 0 != session->ftPEContext.pFTPreAuthReq-> |
| 2655 | ft_ies_length) { |
| 2656 | ft_ies_length = session->ftPEContext. |
| 2657 | pFTPreAuthReq->ft_ies_length; |
| 2658 | frame_len += ft_ies_length; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2659 | pe_debug("Auth frame, FTIES length added=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2660 | ft_ies_length); |
| 2661 | } else { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2662 | pe_debug("Auth frame, Does not contain FTIES!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2663 | frame_len += (2 + SIR_MDIE_SIZE); |
| 2664 | } |
| 2665 | } |
Pragaspathi Thilagaraj | 239883a | 2019-03-08 00:33:50 +0530 | [diff] [blame] | 2666 | |
| 2667 | /* include MDIE in FILS authentication frame */ |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2668 | if (session->lim_join_req && |
| 2669 | session->lim_join_req->is11Rconnection && |
Pragaspathi Thilagaraj | 239883a | 2019-03-08 00:33:50 +0530 | [diff] [blame] | 2670 | auth_frame->authAlgoNumber == SIR_FILS_SK_WITHOUT_PFS && |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2671 | session->lim_join_req->bssDescription.mdiePresent) |
Pragaspathi Thilagaraj | 239883a | 2019-03-08 00:33:50 +0530 | [diff] [blame] | 2672 | frame_len += (2 + SIR_MDIE_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2673 | break; |
| 2674 | |
| 2675 | case SIR_MAC_AUTH_FRAME_2: |
| 2676 | if ((auth_frame->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 2677 | ((auth_frame->authAlgoNumber == eSIR_SHARED_KEY) && |
| 2678 | (auth_frame->authStatusCode != |
| 2679 | eSIR_MAC_SUCCESS_STATUS))) { |
| 2680 | /* |
| 2681 | * Allocate buffer for Authenticaton frame of size |
| 2682 | * equal to management frame header length plus |
| 2683 | * 2 bytes each for auth algorithm number, |
| 2684 | * transaction number and status code. |
| 2685 | */ |
| 2686 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2687 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2688 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2689 | } else { |
| 2690 | /* |
| 2691 | * Shared Key algorithm with challenge text |
| 2692 | * to be sent. |
| 2693 | * |
| 2694 | * Allocate buffer for Authenticaton frame of size |
| 2695 | * equal to management frame header length plus |
| 2696 | * 2 bytes each for auth algorithm number, |
| 2697 | * transaction number, status code and 128 bytes |
| 2698 | * for challenge text. |
| 2699 | */ |
| 2700 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2701 | challenge_req = true; |
| 2702 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN + |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2703 | SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH + |
| 2704 | SIR_MAC_CHALLENGE_ID_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2705 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2706 | } |
| 2707 | break; |
| 2708 | |
| 2709 | case SIR_MAC_AUTH_FRAME_3: |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2710 | /* |
| 2711 | * Auth frame3 to be sent without encrypted framebody |
| 2712 | * |
| 2713 | * Allocate buffer for Authenticaton frame of size equal |
| 2714 | * to management frame header length plus 2 bytes each |
| 2715 | * for auth algorithm number, transaction number and |
| 2716 | * status code. |
| 2717 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2718 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2719 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2720 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2721 | break; |
| 2722 | |
| 2723 | case SIR_MAC_AUTH_FRAME_4: |
| 2724 | /* |
| 2725 | * Allocate buffer for Authenticaton frame of size equal |
| 2726 | * to management frame header length plus 2 bytes each |
| 2727 | * for auth algorithm number, transaction number and |
| 2728 | * status code. |
| 2729 | */ |
| 2730 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2731 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2732 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2733 | |
| 2734 | break; |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2735 | default: |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2736 | pe_err("Invalid auth transaction seq num"); |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2737 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2738 | } /* switch (auth_frame->authTransactionSeqNumber) */ |
| 2739 | |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2740 | alloc_packet: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2741 | qdf_status = cds_packet_alloc((uint16_t) frame_len, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2742 | (void **)&packet); |
| 2743 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2744 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2745 | pe_err("call to bufAlloc failed for AUTH frame"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2746 | return; |
| 2747 | } |
| 2748 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2749 | qdf_mem_zero(frame, frame_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2750 | |
| 2751 | /* Prepare BD */ |
| 2752 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 2753 | SIR_MAC_MGMT_AUTH, peer_addr, session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2754 | mac_hdr = (tpSirMacMgmtHdr) frame; |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2755 | if (wep_challenge_len) |
| 2756 | mac_hdr->fc.wep = LIM_WEP_IN_FC; |
| 2757 | else |
| 2758 | mac_hdr->fc.wep = LIM_NO_WEP_IN_FC; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2759 | |
| 2760 | /* Prepare BSSId */ |
Rajeev Kumar | cf835a0 | 2016-04-15 15:01:31 -0700 | [diff] [blame] | 2761 | if (LIM_IS_AP_ROLE(session)) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2762 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2763 | (uint8_t *) session->bssId, |
| 2764 | sizeof(tSirMacAddr)); |
| 2765 | |
| 2766 | /* Prepare Authentication frame body */ |
| 2767 | body = frame + sizeof(tSirMacMgmtHdr); |
| 2768 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2769 | if (wep_challenge_len) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2770 | qdf_mem_copy(body, (uint8_t *) auth_frame, body_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2771 | |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2772 | pe_debug("Sending Auth seq# 3 to " QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2773 | QDF_MAC_ADDR_ARRAY(mac_hdr->da)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2774 | |
| 2775 | } else { |
| 2776 | *((uint16_t *) (body)) = |
| 2777 | sir_swap_u16if_needed(auth_frame->authAlgoNumber); |
| 2778 | body += sizeof(uint16_t); |
| 2779 | body_len -= sizeof(uint16_t); |
| 2780 | |
| 2781 | *((uint16_t *) (body)) = |
| 2782 | sir_swap_u16if_needed( |
| 2783 | auth_frame->authTransactionSeqNumber); |
| 2784 | body += sizeof(uint16_t); |
| 2785 | body_len -= sizeof(uint16_t); |
| 2786 | |
| 2787 | *((uint16_t *) (body)) = |
| 2788 | sir_swap_u16if_needed(auth_frame->authStatusCode); |
| 2789 | body += sizeof(uint16_t); |
| 2790 | body_len -= sizeof(uint16_t); |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2791 | |
| 2792 | if (challenge_req) { |
| 2793 | if (body_len < SIR_MAC_AUTH_CHALLENGE_BODY_LEN) { |
Himanshu Agarwal | c422ca7 | 2017-09-19 11:07:36 +0530 | [diff] [blame] | 2794 | /* copy challenge IE id, len, challenge text */ |
| 2795 | *body = auth_frame->type; |
| 2796 | body++; |
| 2797 | body_len -= sizeof(uint8_t); |
| 2798 | *body = auth_frame->length; |
| 2799 | body++; |
| 2800 | body_len -= sizeof(uint8_t); |
| 2801 | qdf_mem_copy(body, auth_frame->challengeText, |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2802 | body_len); |
| 2803 | pe_err("Incomplete challenge info: length: %d, expected: %d", |
| 2804 | body_len, |
| 2805 | SIR_MAC_AUTH_CHALLENGE_BODY_LEN); |
| 2806 | body += body_len; |
| 2807 | body_len = 0; |
| 2808 | } else { |
| 2809 | /* copy challenge IE id, len, challenge text */ |
| 2810 | *body = auth_frame->type; |
| 2811 | body++; |
| 2812 | *body = auth_frame->length; |
| 2813 | body++; |
| 2814 | qdf_mem_copy(body, auth_frame->challengeText, |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2815 | SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH); |
| 2816 | body += SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2817 | |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2818 | body_len -= SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH + |
| 2819 | SIR_MAC_CHALLENGE_ID_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2820 | } |
| 2821 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2822 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2823 | if ((auth_frame->authAlgoNumber == eSIR_FT_AUTH) && |
| 2824 | (auth_frame->authTransactionSeqNumber == |
| 2825 | SIR_MAC_AUTH_FRAME_1) && |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2826 | (session->ftPEContext.pFTPreAuthReq)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2827 | |
| 2828 | if (ft_ies_length > 0) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2829 | qdf_mem_copy(body, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2830 | session->ftPEContext. |
| 2831 | pFTPreAuthReq->ft_ies, |
| 2832 | ft_ies_length); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2833 | pe_debug("Auth1 Frame FTIE is: "); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2834 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, |
| 2835 | QDF_TRACE_LEVEL_DEBUG, |
| 2836 | (uint8_t *) body, |
| 2837 | ft_ies_length); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2838 | } else if (session->ftPEContext. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2839 | pFTPreAuthReq->pbssDescription) { |
| 2840 | /* MDID attr is 54 */ |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 2841 | *body = WLAN_ELEMID_MOBILITY_DOMAIN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2842 | body++; |
| 2843 | *body = SIR_MDIE_SIZE; |
| 2844 | body++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2845 | qdf_mem_copy(body, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2846 | &session->ftPEContext.pFTPreAuthReq-> |
| 2847 | pbssDescription->mdie[0], |
| 2848 | SIR_MDIE_SIZE); |
| 2849 | } |
Pragaspathi Thilagaraj | 239883a | 2019-03-08 00:33:50 +0530 | [diff] [blame] | 2850 | } else if ((auth_frame->authAlgoNumber == |
| 2851 | SIR_FILS_SK_WITHOUT_PFS) && |
| 2852 | (auth_frame->authTransactionSeqNumber == |
| 2853 | SIR_MAC_AUTH_FRAME_1)) { |
| 2854 | pe_debug("FILS: appending fils Auth data"); |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2855 | lim_add_fils_data_to_auth_frame(session, body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2856 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2857 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2858 | pe_debug("*** Sending Auth seq# %d status %d (%d) to " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2859 | QDF_MAC_ADDR_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2860 | auth_frame->authTransactionSeqNumber, |
| 2861 | auth_frame->authStatusCode, |
| 2862 | (auth_frame->authStatusCode == |
| 2863 | eSIR_MAC_SUCCESS_STATUS), |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2864 | QDF_MAC_ADDR_ARRAY(mac_hdr->da)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2865 | } |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2866 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, |
| 2867 | QDF_TRACE_LEVEL_DEBUG, |
| 2868 | frame, frame_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2869 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2870 | if ((session->ftPEContext.pFTPreAuthReq) && |
Wu Gao | ceac285 | 2019-11-18 20:13:19 +0800 | [diff] [blame] | 2871 | (!wlan_reg_is_24ghz_ch_freq( |
| 2872 | session->ftPEContext.pFTPreAuthReq->pre_auth_channel_freq))) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2873 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 2874 | else if (wlan_reg_is_5ghz_ch_freq(session->curr_op_freq) || |
| 2875 | session->opmode == QDF_P2P_CLIENT_MODE || |
| 2876 | session->opmode == QDF_P2P_GO_MODE) |
Deepthi Gowri | 1de51e3 | 2016-09-01 15:47:28 +0530 | [diff] [blame] | 2877 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2878 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 2879 | if (session->opmode == QDF_P2P_CLIENT_MODE || |
| 2880 | session->opmode == QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2881 | tx_flag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2882 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2883 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2884 | session->peSessionId, mac_hdr->fc.subType)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2885 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2886 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_NOT_RCD; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2887 | min_rid = lim_get_min_session_txrate(session); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2888 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2889 | session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Rajasekaran Kalidoss | 7152a35 | 2018-11-19 09:58:35 +0530 | [diff] [blame] | 2890 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2891 | if (session->ftPEContext.pFTPreAuthReq) |
Wu Gao | ceac285 | 2019-11-18 20:13:19 +0800 | [diff] [blame] | 2892 | ch_freq_tx_frame = session->ftPEContext. |
| 2893 | pFTPreAuthReq->pre_auth_channel_freq; |
Rajasekaran Kalidoss | 7152a35 | 2018-11-19 09:58:35 +0530 | [diff] [blame] | 2894 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2895 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 2896 | (uint16_t)frame_len, |
| 2897 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 2898 | 7, lim_tx_complete, frame, |
| 2899 | lim_auth_tx_complete_cnf, |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 2900 | tx_flag, vdev_id, false, |
Rajasekaran Kalidoss | 7152a35 | 2018-11-19 09:58:35 +0530 | [diff] [blame] | 2901 | ch_freq_tx_frame, min_rid); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2902 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 2903 | session->peSessionId, qdf_status)); |
| 2904 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 2905 | pe_err("*** Could not send Auth frame, retCode=%X ***", |
| 2906 | qdf_status); |
| 2907 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
| 2908 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2909 | session, SENT_FAIL, QDF_STATUS_E_FAILURE); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2910 | /* Pkt will be freed up by the callback */ |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2911 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2912 | return; |
| 2913 | } |
| 2914 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2915 | QDF_STATUS lim_send_deauth_cnf(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2916 | { |
| 2917 | uint16_t aid; |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2918 | tpDphHashNode sta_ds; |
| 2919 | tLimMlmDeauthReq *deauth_req; |
| 2920 | tLimMlmDeauthCnf deauth_cnf; |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 2921 | struct pe_session *session_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2922 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2923 | deauth_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 2924 | if (deauth_req) { |
| 2925 | if (tx_timer_running( |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 2926 | &mac_ctx->lim.lim_timers.gLimDeauthAckTimer)) |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2927 | lim_deactivate_and_change_timer(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2928 | eLIM_DEAUTH_ACK_TIMER); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2929 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2930 | session_entry = pe_find_session_by_session_id(mac_ctx, |
| 2931 | deauth_req->sessionId); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2932 | if (!session_entry) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2933 | pe_err("session does not exist for given sessionId"); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2934 | deauth_cnf.resultCode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2935 | eSIR_SME_INVALID_PARAMETERS; |
| 2936 | goto end; |
| 2937 | } |
| 2938 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2939 | sta_ds = |
| 2940 | dph_lookup_hash_entry(mac_ctx, |
| 2941 | deauth_req->peer_macaddr.bytes, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 2942 | &aid, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2943 | &session_entry->dph.dphHashTable); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2944 | if (!sta_ds) { |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2945 | deauth_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2946 | goto end; |
| 2947 | } |
| 2948 | |
| 2949 | /* / Receive path cleanup with dummy packet */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2950 | lim_ft_cleanup_pre_auth_info(mac_ctx, session_entry); |
| 2951 | lim_cleanup_rx_path(mac_ctx, sta_ds, session_entry); |
| 2952 | if ((session_entry->limSystemRole == eLIM_STA_ROLE) && |
| 2953 | ( |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 2954 | #ifdef FEATURE_WLAN_ESE |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2955 | (session_entry->isESEconnection) || |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 2956 | #endif |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2957 | (session_entry->isFastRoamIniFeatureEnabled) || |
| 2958 | (session_entry->is11Rconnection))) { |
Jeff Johnson | 11bd4f3 | 2017-09-18 08:15:17 -0700 | [diff] [blame] | 2959 | pe_debug("FT Preauth (%pK,%d) Deauth rc %d src = %d", |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2960 | session_entry, |
| 2961 | session_entry->peSessionId, |
| 2962 | deauth_req->reasonCode, |
| 2963 | deauth_req->deauthTrigger); |
| 2964 | lim_ft_cleanup(mac_ctx, session_entry); |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2965 | } else { |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2966 | #ifdef FEATURE_WLAN_ESE |
Nirav Shah | f359dd2 | 2019-02-20 10:34:28 +0530 | [diff] [blame] | 2967 | pe_debug("No FT Preauth Session Cleanup in role %d" |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2968 | " isESE %d" |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2969 | " isLFR %d" |
| 2970 | " is11r %d, Deauth reason %d Trigger = %d", |
| 2971 | session_entry->limSystemRole, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2972 | session_entry->isESEconnection, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2973 | session_entry->isFastRoamIniFeatureEnabled, |
| 2974 | session_entry->is11Rconnection, |
| 2975 | deauth_req->reasonCode, |
| 2976 | deauth_req->deauthTrigger); |
Nirav Shah | f359dd2 | 2019-02-20 10:34:28 +0530 | [diff] [blame] | 2977 | #else |
| 2978 | pe_debug("No FT Preauth Session Cleanup in role %d" |
| 2979 | " isLFR %d" |
| 2980 | " is11r %d, Deauth reason %d Trigger = %d", |
| 2981 | session_entry->limSystemRole, |
| 2982 | session_entry->isFastRoamIniFeatureEnabled, |
| 2983 | session_entry->is11Rconnection, |
| 2984 | deauth_req->reasonCode, |
| 2985 | deauth_req->deauthTrigger); |
| 2986 | #endif |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2987 | } |
| 2988 | /* Free up buffer allocated for mlmDeauthReq */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2989 | qdf_mem_free(deauth_req); |
| 2990 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2991 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2992 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2993 | end: |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2994 | qdf_copy_macaddr(&deauth_cnf.peer_macaddr, |
| 2995 | &deauth_req->peer_macaddr); |
| 2996 | deauth_cnf.deauthTrigger = deauth_req->deauthTrigger; |
| 2997 | deauth_cnf.aid = deauth_req->aid; |
| 2998 | deauth_cnf.sessionId = deauth_req->sessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2999 | |
| 3000 | /* Free up buffer allocated */ |
| 3001 | /* for mlmDeauthReq */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3002 | qdf_mem_free(deauth_req); |
| 3003 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3004 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3005 | lim_post_sme_message(mac_ctx, |
| 3006 | LIM_MLM_DEAUTH_CNF, (uint32_t *) &deauth_cnf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3007 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3008 | } |
| 3009 | |
| 3010 | /** |
| 3011 | * lim_send_disassoc_cnf() - Send disassoc confirmation to SME |
| 3012 | * |
| 3013 | * @mac_ctx: Handle to MAC context |
| 3014 | * |
| 3015 | * Sends disassoc confirmation to SME. Removes disassoc request stored |
| 3016 | * in lim. |
| 3017 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3018 | * Return: QDF_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3019 | */ |
| 3020 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3021 | QDF_STATUS lim_send_disassoc_cnf(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3022 | { |
| 3023 | uint16_t aid; |
| 3024 | tpDphHashNode sta_ds; |
| 3025 | tLimMlmDisassocCnf disassoc_cnf; |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 3026 | struct pe_session *pe_session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3027 | tLimMlmDisassocReq *disassoc_req; |
| 3028 | |
| 3029 | disassoc_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 3030 | if (disassoc_req) { |
| 3031 | if (tx_timer_running( |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 3032 | &mac_ctx->lim.lim_timers.gLimDisassocAckTimer)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3033 | lim_deactivate_and_change_timer(mac_ctx, |
| 3034 | eLIM_DISASSOC_ACK_TIMER); |
| 3035 | |
| 3036 | pe_session = pe_find_session_by_session_id( |
| 3037 | mac_ctx, disassoc_req->sessionId); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3038 | if (!pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3039 | pe_err("No session for given sessionId"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3040 | disassoc_cnf.resultCode = |
| 3041 | eSIR_SME_INVALID_PARAMETERS; |
| 3042 | goto end; |
| 3043 | } |
| 3044 | |
| 3045 | sta_ds = dph_lookup_hash_entry(mac_ctx, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 3046 | disassoc_req->peer_macaddr.bytes, &aid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3047 | &pe_session->dph.dphHashTable); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3048 | if (!sta_ds) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3049 | pe_err("StaDs Null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3050 | disassoc_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3051 | goto end; |
| 3052 | } |
| 3053 | /* Receive path cleanup with dummy packet */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3054 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3055 | lim_cleanup_rx_path(mac_ctx, sta_ds, pe_session)) { |
| 3056 | disassoc_cnf.resultCode = |
| 3057 | eSIR_SME_RESOURCES_UNAVAILABLE; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3058 | pe_err("cleanup_rx_path error"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3059 | goto end; |
| 3060 | } |
Deepak Dhamdhere | 57c95ff | 2016-09-30 16:44:44 -0700 | [diff] [blame] | 3061 | if (LIM_IS_STA_ROLE(pe_session) && |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3062 | (disassoc_req->reasonCode != |
| 3063 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) { |
Jeff Johnson | 11bd4f3 | 2017-09-18 08:15:17 -0700 | [diff] [blame] | 3064 | pe_debug("FT Preauth Session (%pK %d) Clean up", |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3065 | pe_session, pe_session->peSessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3066 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3067 | /* Delete FT session if there exists one */ |
| 3068 | lim_ft_cleanup_pre_auth_info(mac_ctx, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3069 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3070 | /* Free up buffer allocated for mlmDisassocReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3071 | qdf_mem_free(disassoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3072 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3073 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3074 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3075 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3076 | } |
| 3077 | end: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3078 | qdf_mem_copy((uint8_t *) &disassoc_cnf.peerMacAddr, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 3079 | (uint8_t *) disassoc_req->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3080 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3081 | disassoc_cnf.aid = disassoc_req->aid; |
| 3082 | disassoc_cnf.disassocTrigger = disassoc_req->disassocTrigger; |
| 3083 | |
| 3084 | /* Update PE session ID */ |
| 3085 | disassoc_cnf.sessionId = disassoc_req->sessionId; |
| 3086 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3087 | if (disassoc_req) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3088 | /* / Free up buffer allocated for mlmDisassocReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3089 | qdf_mem_free(disassoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3090 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3091 | } |
| 3092 | |
| 3093 | lim_post_sme_message(mac_ctx, LIM_MLM_DISASSOC_CNF, |
| 3094 | (uint32_t *) &disassoc_cnf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3095 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3096 | } |
| 3097 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3098 | QDF_STATUS lim_disassoc_tx_complete_cnf(void *context, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3099 | uint32_t tx_success, |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3100 | void *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3101 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3102 | struct mac_context *max_ctx = (struct mac_context *)context; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3103 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3104 | pe_debug("tx_success: %d", tx_success); |
| 3105 | |
| 3106 | return lim_send_disassoc_cnf(max_ctx); |
| 3107 | } |
| 3108 | |
| 3109 | static QDF_STATUS lim_disassoc_tx_complete_cnf_handler(void *context, |
| 3110 | qdf_nbuf_t buf, |
| 3111 | uint32_t tx_success, |
| 3112 | void *params) |
| 3113 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3114 | struct mac_context *max_ctx = (struct mac_context *)context; |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3115 | QDF_STATUS status_code; |
| 3116 | struct scheduler_msg msg = {0}; |
| 3117 | |
| 3118 | pe_debug("tx_success: %d", tx_success); |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 3119 | |
| 3120 | if (buf) |
| 3121 | qdf_nbuf_free(buf); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3122 | msg.type = (uint16_t) WMA_DISASSOC_TX_COMP; |
| 3123 | msg.bodyptr = params; |
| 3124 | msg.bodyval = tx_success; |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 3125 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3126 | status_code = lim_post_msg_high_priority(max_ctx, &msg); |
| 3127 | if (status_code != QDF_STATUS_SUCCESS) |
| 3128 | pe_err("posting message: %X to LIM failed, reason: %d", |
| 3129 | msg.type, status_code); |
| 3130 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3131 | } |
| 3132 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3133 | QDF_STATUS lim_deauth_tx_complete_cnf(void *context, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3134 | uint32_t tx_success, |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3135 | void *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3136 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3137 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3138 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3139 | pe_debug("tx_success: %d", tx_success); |
| 3140 | |
| 3141 | return lim_send_deauth_cnf(mac_ctx); |
| 3142 | } |
| 3143 | |
| 3144 | static QDF_STATUS lim_deauth_tx_complete_cnf_handler(void *context, |
| 3145 | qdf_nbuf_t buf, |
| 3146 | uint32_t tx_success, |
| 3147 | void *params) |
| 3148 | { |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3149 | struct mac_context *mac_ctx = (struct mac_context *)context; |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3150 | QDF_STATUS status_code; |
| 3151 | struct scheduler_msg msg = {0}; |
| 3152 | |
| 3153 | pe_debug("tx_success: %d", tx_success); |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 3154 | |
| 3155 | if (buf) |
| 3156 | qdf_nbuf_free(buf); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3157 | msg.type = (uint16_t) WMA_DEAUTH_TX_COMP; |
| 3158 | msg.bodyptr = params; |
| 3159 | msg.bodyval = tx_success; |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 3160 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3161 | status_code = lim_post_msg_high_priority(mac_ctx, &msg); |
| 3162 | if (status_code != QDF_STATUS_SUCCESS) |
| 3163 | pe_err("posting message: %X to LIM failed, reason: %d", |
| 3164 | msg.type, status_code); |
| 3165 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3166 | } |
| 3167 | |
| 3168 | /** |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3169 | * lim_append_ies_to_frame() - Append IEs to the frame |
| 3170 | * |
| 3171 | * @frame: Pointer to the frame buffer that needs to be populated |
| 3172 | * @frame_len: Pointer for current frame length |
| 3173 | * @ie: pointer for disconnect IEs |
| 3174 | * |
| 3175 | * This function is called by lim_send_disassoc_mgmt_frame and |
| 3176 | * lim_send_deauth_mgmt_frame APIs as part of disconnection. |
| 3177 | * Append IEs and update frame length. |
| 3178 | * |
| 3179 | * Return: None |
| 3180 | */ |
| 3181 | static void |
| 3182 | lim_append_ies_to_frame(uint8_t *frame, uint32_t *frame_len, |
| 3183 | struct wlan_ies *ie) |
| 3184 | { |
| 3185 | if (!ie || !ie->len || !ie->data) |
| 3186 | return; |
| 3187 | qdf_mem_copy(frame, ie->data, ie->len); |
| 3188 | *frame_len += ie->len; |
| 3189 | pe_debug("Appended IEs len: %u", ie->len); |
| 3190 | } |
| 3191 | |
| 3192 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3193 | * \brief This function is called to send Disassociate frame. |
| 3194 | * |
| 3195 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3196 | * \param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3197 | * |
| 3198 | * \param nReason Indicates the reason that need to be sent in |
| 3199 | * Disassociation frame |
| 3200 | * |
| 3201 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 3202 | * sent |
| 3203 | * |
| 3204 | * |
| 3205 | */ |
| 3206 | |
| 3207 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3208 | lim_send_disassoc_mgmt_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3209 | uint16_t nReason, |
| 3210 | tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3211 | struct pe_session *pe_session, bool waitForAck) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3212 | { |
| 3213 | tDot11fDisassociation frm; |
| 3214 | uint8_t *pFrame; |
| 3215 | tpSirMacMgmtHdr pMacHdr; |
| 3216 | uint32_t nBytes, nPayload, nStatus; |
| 3217 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3218 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3219 | uint8_t txFlag = 0; |
| 3220 | uint32_t val = 0; |
| 3221 | uint8_t smeSessionId = 0; |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3222 | struct wlan_ies *discon_ie; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 3223 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3224 | if (!pe_session) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3225 | return; |
| 3226 | } |
| 3227 | |
| 3228 | /* |
| 3229 | * In case when cac timer is running for this SAP session then |
| 3230 | * avoid sending disassoc out. It is violation of dfs specification. |
| 3231 | */ |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3232 | if (((pe_session->opmode == QDF_SAP_MODE) || |
| 3233 | (pe_session->opmode == QDF_P2P_GO_MODE)) && |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3234 | (true == mac->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3235 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3236 | FL("CAC timer is running, drop disassoc from going out")); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3237 | if (waitForAck) |
| 3238 | lim_send_disassoc_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3239 | return; |
| 3240 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3241 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3242 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3243 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3244 | |
| 3245 | frm.Reason.code = nReason; |
| 3246 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3247 | nStatus = dot11f_get_packed_disassociation_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3248 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3249 | 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] | 3250 | nStatus); |
| 3251 | /* We'll fall back on the worst case scenario: */ |
| 3252 | nPayload = sizeof(tDot11fDisassociation); |
| 3253 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3254 | pe_warn("There were warnings while calculating the packed size for a Disassociation (0x%08x)", |
| 3255 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3256 | } |
| 3257 | |
| 3258 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3259 | |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3260 | discon_ie = mlme_get_self_disconnect_ies(pe_session->vdev); |
| 3261 | if (discon_ie && discon_ie->len) |
| 3262 | nBytes += discon_ie->len; |
| 3263 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3264 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3265 | (void **)&pPacket); |
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 allocate %d bytes for a Disassociation", |
| 3268 | nBytes); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3269 | if (waitForAck) |
| 3270 | lim_send_disassoc_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3271 | return; |
| 3272 | } |
| 3273 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3274 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3275 | |
| 3276 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3277 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3278 | SIR_MAC_MGMT_DISASSOC, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3279 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3280 | |
| 3281 | /* Prepare the BSSID */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3282 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3283 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3284 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3285 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3286 | nStatus = dot11f_pack_disassociation(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3287 | sizeof(tSirMacMgmtHdr), |
| 3288 | nPayload, &nPayload); |
| 3289 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3290 | pe_err("Failed to pack a Disassociation (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3291 | nStatus); |
| 3292 | cds_packet_free((void *)pPacket); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3293 | if (waitForAck) |
| 3294 | lim_send_disassoc_cnf(mac); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3295 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3296 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3297 | pe_warn("There were warnings while packing a Disassociation (0x%08x)", |
| 3298 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3299 | } |
| 3300 | |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3301 | /* Copy disconnect IEs to the end of the frame */ |
| 3302 | lim_append_ies_to_frame(pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3303 | &nPayload, discon_ie); |
| 3304 | mlme_free_self_disconnect_ies(pe_session->vdev); |
| 3305 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3306 | pe_debug("***Sessionid %d Sending Disassociation frame with " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3307 | "reason %u and waitForAck %d to " QDF_MAC_ADDR_STR " ,From " |
| 3308 | QDF_MAC_ADDR_STR, pe_session->peSessionId, nReason, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3309 | waitForAck, QDF_MAC_ADDR_ARRAY(pMacHdr->da), |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3310 | QDF_MAC_ADDR_ARRAY(pe_session->self_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3311 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 3312 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 3313 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 3314 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3315 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3316 | |
Sushant Kaushik | 4655606 | 2015-12-02 16:57:47 +0530 | [diff] [blame] | 3317 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3318 | |
| 3319 | if (waitForAck) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3320 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3321 | pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3322 | pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3323 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3324 | pe_session, QDF_STATUS_SUCCESS, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3325 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3326 | /* Queue Disassociation frame in high priority WQ */ |
| 3327 | /* get the duration from the request */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3328 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3329 | wma_tx_frameWithTxComplete(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3330 | TXRX_FRM_802_11_MGMT, |
| 3331 | ANI_TXDIR_TODS, 7, lim_tx_complete, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3332 | pFrame, lim_disassoc_tx_complete_cnf_handler, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3333 | txFlag, smeSessionId, false, 0, |
| 3334 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3335 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3336 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3337 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3338 | |
| 3339 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 3340 | |
| 3341 | if (tx_timer_change |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 3342 | (&mac->lim.lim_timers.gLimDisassocAckTimer, val, 0) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3343 | != TX_SUCCESS) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3344 | pe_err("Unable to change Disassoc ack Timer val"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3345 | return; |
| 3346 | } else if (TX_SUCCESS != |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 3347 | tx_timer_activate(&mac->lim.lim_timers. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3348 | gLimDisassocAckTimer)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3349 | pe_err("Unable to activate Disassoc ack Timer"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3350 | lim_deactivate_and_change_timer(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3351 | eLIM_DISASSOC_ACK_TIMER); |
| 3352 | return; |
| 3353 | } |
| 3354 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3355 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3356 | pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3357 | pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3358 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3359 | pe_session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3360 | QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3361 | /* Queue Disassociation frame in high priority WQ */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3362 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3363 | TXRX_FRM_802_11_MGMT, |
| 3364 | ANI_TXDIR_TODS, |
| 3365 | 7, |
| 3366 | lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3367 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3368 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3369 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3370 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3371 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3372 | pe_err("Failed to send Disassociation (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3373 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3374 | /* Pkt will be freed up by the callback */ |
| 3375 | } |
| 3376 | } |
| 3377 | } /* End lim_send_disassoc_mgmt_frame. */ |
| 3378 | |
| 3379 | /** |
| 3380 | * \brief This function is called to send a Deauthenticate frame |
| 3381 | * |
| 3382 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3383 | * \param mac Pointer to global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3384 | * |
| 3385 | * \param nReason Indicates the reason that need to be sent in the |
| 3386 | * Deauthenticate frame |
| 3387 | * |
| 3388 | * \param peeer address of the STA to which the frame is to be sent |
| 3389 | * |
| 3390 | * |
| 3391 | */ |
| 3392 | |
| 3393 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3394 | lim_send_deauth_mgmt_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3395 | uint16_t nReason, |
| 3396 | tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3397 | struct pe_session *pe_session, bool waitForAck) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3398 | { |
| 3399 | tDot11fDeAuth frm; |
| 3400 | uint8_t *pFrame; |
| 3401 | tpSirMacMgmtHdr pMacHdr; |
| 3402 | uint32_t nBytes, nPayload, nStatus; |
| 3403 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3404 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3405 | uint8_t txFlag = 0; |
| 3406 | uint32_t val = 0; |
| 3407 | #ifdef FEATURE_WLAN_TDLS |
| 3408 | uint16_t aid; |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3409 | tpDphHashNode sta; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3410 | #endif |
| 3411 | uint8_t smeSessionId = 0; |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3412 | struct wlan_ies *discon_ie; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3413 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3414 | if (!pe_session) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3415 | return; |
| 3416 | } |
| 3417 | |
| 3418 | /* |
| 3419 | * In case when cac timer is running for this SAP session then |
| 3420 | * avoid deauth frame out. It is violation of dfs specification. |
| 3421 | */ |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3422 | if (((pe_session->opmode == QDF_SAP_MODE) || |
| 3423 | (pe_session->opmode == QDF_P2P_GO_MODE)) && |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3424 | (true == mac->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3425 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3426 | FL |
| 3427 | ("CAC timer is running, drop the deauth from going out")); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3428 | if (waitForAck) |
| 3429 | lim_send_deauth_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3430 | return; |
| 3431 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3432 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3433 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3434 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3435 | |
| 3436 | frm.Reason.code = nReason; |
| 3437 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3438 | nStatus = dot11f_get_packed_de_auth_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3439 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3440 | 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] | 3441 | nStatus); |
| 3442 | /* We'll fall back on the worst case scenario: */ |
| 3443 | nPayload = sizeof(tDot11fDeAuth); |
| 3444 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3445 | pe_warn("There were warnings while calculating the packed size for a De-Authentication (0x%08x)", |
| 3446 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3447 | } |
| 3448 | |
| 3449 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3450 | discon_ie = mlme_get_self_disconnect_ies(pe_session->vdev); |
| 3451 | if (discon_ie && discon_ie->len) |
| 3452 | nBytes += discon_ie->len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3453 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3454 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3455 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3456 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3457 | pe_err("Failed to allocate %d bytes for a De-Authentication", |
| 3458 | nBytes); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3459 | if (waitForAck) |
| 3460 | lim_send_deauth_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3461 | return; |
| 3462 | } |
| 3463 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3464 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3465 | |
| 3466 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3467 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3468 | SIR_MAC_MGMT_DEAUTH, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3469 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3470 | |
| 3471 | /* Prepare the BSSID */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3472 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3473 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3474 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3475 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3476 | nStatus = dot11f_pack_de_auth(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3477 | sizeof(tSirMacMgmtHdr), nPayload, &nPayload); |
| 3478 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3479 | pe_err("Failed to pack a DeAuthentication (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3480 | nStatus); |
| 3481 | cds_packet_free((void *)pPacket); |
Abhishek Singh | 06522c5 | 2019-05-08 12:13:42 +0530 | [diff] [blame] | 3482 | if (waitForAck) |
| 3483 | lim_send_deauth_cnf(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3484 | return; |
| 3485 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3486 | pe_warn("There were warnings while packing a De-Authentication (0x%08x)", |
| 3487 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3488 | } |
Srinivas Dasari | e2ee094 | 2019-06-29 14:34:50 +0530 | [diff] [blame] | 3489 | |
| 3490 | /* Copy disconnect IEs to the end of the frame */ |
| 3491 | lim_append_ies_to_frame(pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3492 | &nPayload, discon_ie); |
| 3493 | mlme_free_self_disconnect_ies(pe_session->vdev); |
| 3494 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3495 | pe_debug("***Sessionid %d Sending Deauth frame with " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3496 | "reason %u and waitForAck %d to " QDF_MAC_ADDR_STR |
| 3497 | " ,From " QDF_MAC_ADDR_STR, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3498 | pe_session->peSessionId, nReason, waitForAck, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3499 | QDF_MAC_ADDR_ARRAY(pMacHdr->da), |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3500 | QDF_MAC_ADDR_ARRAY(pe_session->self_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3501 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 3502 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 3503 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 3504 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3505 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3506 | |
Sushant Kaushik | 4655606 | 2015-12-02 16:57:47 +0530 | [diff] [blame] | 3507 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3508 | #ifdef FEATURE_WLAN_TDLS |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3509 | sta = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3510 | dph_lookup_hash_entry(mac, peer, &aid, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3511 | &pe_session->dph.dphHashTable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3512 | #endif |
| 3513 | |
| 3514 | if (waitForAck) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3515 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3516 | pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3517 | pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3518 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3519 | pe_session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3520 | QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3521 | /* Queue Disassociation frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3522 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3523 | wma_tx_frameWithTxComplete(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3524 | TXRX_FRM_802_11_MGMT, |
| 3525 | ANI_TXDIR_TODS, 7, lim_tx_complete, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3526 | pFrame, lim_deauth_tx_complete_cnf_handler, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3527 | txFlag, smeSessionId, false, 0, |
| 3528 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3529 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3530 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3531 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3532 | /* Pkt will be freed up by the callback lim_tx_complete */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3533 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3534 | pe_err("Failed to send De-Authentication (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3535 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3536 | |
| 3537 | /* Call lim_process_deauth_ack_timeout which will send |
| 3538 | * DeauthCnf for this frame |
| 3539 | */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3540 | lim_process_deauth_ack_timeout(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3541 | return; |
| 3542 | } |
| 3543 | |
| 3544 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 3545 | |
| 3546 | if (tx_timer_change |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 3547 | (&mac->lim.lim_timers.gLimDeauthAckTimer, val, 0) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3548 | != TX_SUCCESS) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3549 | pe_err("Unable to change Deauth ack Timer val"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3550 | return; |
| 3551 | } else if (TX_SUCCESS != |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 3552 | tx_timer_activate(&mac->lim.lim_timers. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3553 | gLimDeauthAckTimer)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3554 | pe_err("Unable to activate Deauth ack Timer"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3555 | lim_deactivate_and_change_timer(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3556 | eLIM_DEAUTH_ACK_TIMER); |
| 3557 | return; |
| 3558 | } |
| 3559 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3560 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3561 | pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3562 | pMacHdr->fc.subType)); |
| 3563 | #ifdef FEATURE_WLAN_TDLS |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3564 | if ((sta) |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3565 | && (STA_ENTRY_TDLS_PEER == sta->staType)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3566 | /* Queue Disassociation frame in high priority WQ */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3567 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3568 | pe_session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3569 | QDF_STATUS_SUCCESS, |
| 3570 | QDF_STATUS_SUCCESS); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3571 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3572 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3573 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_IBSS, |
| 3574 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3575 | smeSessionId, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3576 | } else { |
| 3577 | #endif |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3578 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3579 | pe_session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3580 | QDF_STATUS_SUCCESS, |
| 3581 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3582 | /* Queue Disassociation frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3583 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3584 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3585 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3586 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3587 | smeSessionId, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3588 | #ifdef FEATURE_WLAN_TDLS |
| 3589 | } |
| 3590 | #endif |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3591 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3592 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3593 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3594 | pe_err("Failed to send De-Authentication (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3595 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3596 | /* Pkt will be freed up by the callback */ |
| 3597 | } |
| 3598 | } |
| 3599 | |
| 3600 | } /* End lim_send_deauth_mgmt_frame. */ |
| 3601 | |
| 3602 | #ifdef ANI_SUPPORT_11H |
| 3603 | /** |
| 3604 | * \brief Send a Measurement Report Action frame |
| 3605 | * |
| 3606 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3607 | * \param mac Pointer to the global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3608 | * |
| 3609 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 3610 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3611 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3612 | * |
| 3613 | * |
| 3614 | */ |
| 3615 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3616 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3617 | lim_send_meas_report_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3618 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3619 | tSirMacAddr peer, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3620 | { |
| 3621 | tDot11fMeasurementReport frm; |
| 3622 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3623 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3624 | tpSirMacMgmtHdr pMacHdr; |
| 3625 | uint32_t nBytes, nPayload, nStatus; |
| 3626 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3627 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3628 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3629 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3630 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 3631 | frm.Category.category = ACTION_CATEGORY_SPECTRUM_MGMT; |
Srinivas Girigowda | f8e5d2e | 2019-05-28 11:49:29 -0700 | [diff] [blame] | 3632 | frm.Action.action = ACTION_SPCT_MSR_RPRT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3633 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 3634 | |
| 3635 | switch (pMeasReqFrame->measReqIE.measType) { |
| 3636 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 3637 | nSirStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3638 | populate_dot11f_measurement_report0(mac, pMeasReqFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3639 | &frm.MeasurementReport); |
| 3640 | break; |
| 3641 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 3642 | nSirStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3643 | populate_dot11f_measurement_report1(mac, pMeasReqFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3644 | &frm.MeasurementReport); |
| 3645 | break; |
| 3646 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 3647 | nSirStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3648 | populate_dot11f_measurement_report2(mac, pMeasReqFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3649 | &frm.MeasurementReport); |
| 3650 | break; |
| 3651 | default: |
Jeff Johnson | 0711e27 | 2018-12-14 23:16:38 -0800 | [diff] [blame] | 3652 | pe_err("Unknown measurement type %d in limSendMeasReportFrame", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3653 | pMeasReqFrame->measReqIE.measType); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3654 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3655 | } |
| 3656 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3657 | if (QDF_STATUS_SUCCESS != nSirStatus) |
| 3658 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3659 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3660 | nStatus = dot11f_get_packed_measurement_report_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3661 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3662 | 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] | 3663 | nStatus); |
| 3664 | /* We'll fall back on the worst case scenario: */ |
| 3665 | nPayload = sizeof(tDot11fMeasurementReport); |
| 3666 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3667 | pe_warn("There were warnings while calculating the packed size for a Measurement Report (0x%08x)", |
| 3668 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3669 | } |
| 3670 | |
| 3671 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3672 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3673 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3674 | cds_packet_alloc(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3675 | (uint16_t) nBytes, (void **)&pFrame, |
| 3676 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3677 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 0711e27 | 2018-12-14 23:16:38 -0800 | [diff] [blame] | 3678 | pe_err("Failed to allocate %d bytes for a De-Authentication", |
| 3679 | nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3680 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3681 | } |
| 3682 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3683 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3684 | |
| 3685 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3686 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3687 | SIR_MAC_MGMT_ACTION, peer); |
| 3688 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3689 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3690 | qdf_mem_copy(pMacHdr->bssId, pe_session->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3691 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3692 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3693 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3694 | nStatus = dot11f_pack_measurement_report(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3695 | sizeof(tSirMacMgmtHdr), |
| 3696 | nPayload, &nPayload); |
| 3697 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3698 | pe_err("Failed to pack a Measurement Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3699 | nStatus); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3700 | cds_packet_free(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3701 | (void *)pFrame, (void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3702 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3703 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3704 | pe_warn("There were warnings while packing a Measurement Report (0x%08x)", |
| 3705 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3706 | } |
| 3707 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3708 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3709 | ((pe_session) ? pe_session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3710 | peSessionId : NO_SESSION), pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3711 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3712 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3713 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3714 | lim_tx_complete, pFrame, 0, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3715 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3716 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3717 | ((pe_session) ? pe_session->peSessionId : NO_SESSION), |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3718 | qdf_status)); |
| 3719 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3720 | pe_err("Failed to send a Measurement Report (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3721 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3722 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3723 | return QDF_STATUS_E_FAILURE; /* just allocated... */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3724 | } |
| 3725 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3726 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3727 | |
| 3728 | } /* End lim_send_meas_report_frame. */ |
| 3729 | |
| 3730 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3731 | * \brief Send a TPC Report Action frame |
| 3732 | * |
| 3733 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3734 | * \param mac Pointer to the global MAC datastructure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3735 | * |
| 3736 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 3737 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3738 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3739 | * |
| 3740 | * |
| 3741 | */ |
| 3742 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3743 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3744 | lim_send_tpc_report_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3745 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3746 | tSirMacAddr peer, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3747 | { |
| 3748 | tDot11fTPCReport frm; |
| 3749 | uint8_t *pFrame; |
| 3750 | tpSirMacMgmtHdr pMacHdr; |
| 3751 | uint32_t nBytes, nPayload, nStatus; |
| 3752 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3753 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3754 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3755 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3756 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 3757 | frm.Category.category = ACTION_CATEGORY_SPECTRUM_MGMT; |
Srinivas Girigowda | f8e5d2e | 2019-05-28 11:49:29 -0700 | [diff] [blame] | 3758 | frm.Action.action = ACTION_SPCT_TPC_RPRT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3759 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 3760 | |
| 3761 | frm.TPCReport.tx_power = 0; |
| 3762 | frm.TPCReport.link_margin = 0; |
| 3763 | frm.TPCReport.present = 1; |
| 3764 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3765 | nStatus = dot11f_get_packed_tpc_report_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3766 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3767 | 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] | 3768 | /* We'll fall back on the worst case scenario: */ |
| 3769 | nPayload = sizeof(tDot11fTPCReport); |
| 3770 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3771 | pe_warn("There were warnings while calculating the packed size for a TPC Report (0x%08x)", |
| 3772 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3773 | } |
| 3774 | |
| 3775 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3776 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3777 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3778 | cds_packet_alloc(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3779 | (uint16_t) nBytes, (void **)&pFrame, |
| 3780 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3781 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3782 | pe_err("Failed to allocate %d bytes for a TPC" |
| 3783 | " Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3784 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3785 | } |
| 3786 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3787 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3788 | |
| 3789 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3790 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3791 | SIR_MAC_MGMT_ACTION, peer); |
| 3792 | |
| 3793 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3794 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3795 | qdf_mem_copy(pMacHdr->bssId, pe_session->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3796 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3797 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3798 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3799 | nStatus = dot11f_pack_tpc_report(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3800 | sizeof(tSirMacMgmtHdr), |
| 3801 | nPayload, &nPayload); |
| 3802 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3803 | pe_err("Failed to pack a TPC Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3804 | nStatus); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3805 | cds_packet_free(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3806 | (void *)pFrame, (void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3807 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3808 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3809 | pe_warn("There were warnings while packing a TPC Report (0x%08x)", |
| 3810 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3811 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3812 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3813 | ((pe_session) ? pe_session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3814 | peSessionId : NO_SESSION), pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3815 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3816 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3817 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3818 | lim_tx_complete, pFrame, 0, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3819 | MTRACE(qdf_trace |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3820 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3821 | ((pe_session) ? pe_session->peSessionId : NO_SESSION), |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3822 | qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3823 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3824 | pe_err("Failed to send a TPC Report (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3825 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3826 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3827 | return QDF_STATUS_E_FAILURE; /* just allocated... */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3828 | } |
| 3829 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3830 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3831 | |
| 3832 | } /* End lim_send_tpc_report_frame. */ |
| 3833 | #endif /* ANI_SUPPORT_11H */ |
| 3834 | |
| 3835 | /** |
| 3836 | * \brief Send a Channel Switch Announcement |
| 3837 | * |
| 3838 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3839 | * \param mac Pointer to the global MAC datastructure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3840 | * |
| 3841 | * \param peer MAC address to which this frame will be sent |
| 3842 | * |
| 3843 | * \param nMode |
| 3844 | * |
| 3845 | * \param nNewChannel |
| 3846 | * |
| 3847 | * \param nCount |
| 3848 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3849 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3850 | * |
| 3851 | * |
| 3852 | */ |
| 3853 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3854 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3855 | lim_send_channel_switch_mgmt_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3856 | tSirMacAddr peer, |
| 3857 | uint8_t nMode, |
| 3858 | uint8_t nNewChannel, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3859 | uint8_t nCount, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3860 | { |
| 3861 | tDot11fChannelSwitch frm; |
| 3862 | uint8_t *pFrame; |
| 3863 | tpSirMacMgmtHdr pMacHdr; |
| 3864 | uint32_t nBytes, nPayload, nStatus; /* , nCfg; */ |
| 3865 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3866 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3867 | uint8_t txFlag = 0; |
| 3868 | |
| 3869 | uint8_t smeSessionId = 0; |
| 3870 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3871 | if (!pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3872 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3873 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3874 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3875 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3876 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3877 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3878 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 3879 | frm.Category.category = ACTION_CATEGORY_SPECTRUM_MGMT; |
Srinivas Girigowda | f8e5d2e | 2019-05-28 11:49:29 -0700 | [diff] [blame] | 3880 | frm.Action.action = ACTION_SPCT_CHL_SWITCH; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3881 | frm.ChanSwitchAnn.switchMode = nMode; |
| 3882 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 3883 | frm.ChanSwitchAnn.switchCount = nCount; |
| 3884 | frm.ChanSwitchAnn.present = 1; |
| 3885 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3886 | nStatus = dot11f_get_packed_channel_switch_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3887 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3888 | 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] | 3889 | nStatus); |
| 3890 | /* We'll fall back on the worst case scenario: */ |
| 3891 | nPayload = sizeof(tDot11fChannelSwitch); |
| 3892 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3893 | pe_warn("There were warnings while calculating the packed size for a Channel Switch (0x%08x)", |
| 3894 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3895 | } |
| 3896 | |
| 3897 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3898 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3899 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3900 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 3901 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3902 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3903 | pe_err("Failed to allocate %d bytes for a TPC Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3904 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3905 | } |
| 3906 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3907 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3908 | |
| 3909 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3910 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3911 | SIR_MAC_MGMT_ACTION, peer, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 3912 | pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3913 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3914 | qdf_mem_copy((uint8_t *) pMacHdr->bssId, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3915 | (uint8_t *) pe_session->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3916 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3917 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3918 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3919 | nStatus = dot11f_pack_channel_switch(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3920 | sizeof(tSirMacMgmtHdr), |
| 3921 | nPayload, &nPayload); |
| 3922 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3923 | pe_err("Failed to pack a Channel Switch (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3924 | nStatus); |
| 3925 | cds_packet_free((void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3926 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3927 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3928 | pe_warn("There were warnings while packing a Channel Switch (0x%08x)", |
| 3929 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3930 | } |
| 3931 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 3932 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 3933 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 3934 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3935 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3936 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3937 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3938 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 3939 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3940 | TXRX_FRM_802_11_MGMT, |
| 3941 | ANI_TXDIR_TODS, |
| 3942 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3943 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3944 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3945 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3946 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3947 | pe_err("Failed to send a Channel Switch (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3948 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3949 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3950 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3951 | } |
| 3952 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3953 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3954 | |
| 3955 | } /* End lim_send_channel_switch_mgmt_frame. */ |
| 3956 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3957 | /** |
| 3958 | * lim_send_extended_chan_switch_action_frame()- function to send ECSA |
| 3959 | * action frame over the air . |
| 3960 | * @mac_ctx: pointer to global mac structure |
| 3961 | * @peer: Destination mac. |
| 3962 | * @mode: channel switch mode |
| 3963 | * @new_op_class: new op class |
| 3964 | * @new_channel: new channel to switch |
| 3965 | * @count: channel switch count |
| 3966 | * |
| 3967 | * This function is called to send ECSA frame. |
| 3968 | * |
| 3969 | * Return: success if frame is sent else return failure |
| 3970 | */ |
| 3971 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3972 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3973 | lim_send_extended_chan_switch_action_frame(struct mac_context *mac_ctx, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3974 | tSirMacAddr peer, uint8_t mode, uint8_t new_op_class, |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 3975 | uint8_t new_channel, uint8_t count, struct pe_session *session_entry) |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3976 | { |
| 3977 | tDot11fext_channel_switch_action_frame frm; |
| 3978 | uint8_t *frame; |
| 3979 | tpSirMacMgmtHdr mac_hdr; |
| 3980 | uint32_t num_bytes, n_payload, status; |
| 3981 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3982 | QDF_STATUS qdf_status; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3983 | uint8_t txFlag = 0; |
Abhishek Singh | 345be41 | 2019-11-19 10:59:29 +0530 | [diff] [blame] | 3984 | uint8_t vdev_id = 0; |
Vignesh Viswanathan | 93b7f70 | 2017-12-19 17:48:45 +0530 | [diff] [blame] | 3985 | uint8_t ch_spacing; |
| 3986 | tLimWiderBWChannelSwitchInfo *wide_bw_ie; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3987 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3988 | if (!session_entry) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3989 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3990 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3991 | } |
| 3992 | |
Abhishek Singh | 345be41 | 2019-11-19 10:59:29 +0530 | [diff] [blame] | 3993 | vdev_id = session_entry->smeSessionId; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3994 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3995 | qdf_mem_zero(&frm, sizeof(frm)); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3996 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 3997 | frm.Category.category = ACTION_CATEGORY_PUBLIC; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3998 | frm.Action.action = SIR_MAC_ACTION_EXT_CHANNEL_SWITCH_ID; |
| 3999 | |
| 4000 | frm.ext_chan_switch_ann_action.switch_mode = mode; |
| 4001 | frm.ext_chan_switch_ann_action.op_class = new_op_class; |
| 4002 | frm.ext_chan_switch_ann_action.new_channel = new_channel; |
| 4003 | frm.ext_chan_switch_ann_action.switch_count = count; |
| 4004 | |
Vignesh Viswanathan | 93b7f70 | 2017-12-19 17:48:45 +0530 | [diff] [blame] | 4005 | ch_spacing = wlan_reg_dmn_get_chanwidth_from_opclass( |
| 4006 | mac_ctx->scan.countryCodeCurrent, new_channel, |
| 4007 | new_op_class); |
| 4008 | pe_debug("wrapper: ch_spacing %hu", ch_spacing); |
| 4009 | |
| 4010 | if ((ch_spacing == 80) || (ch_spacing == 160)) { |
| 4011 | wide_bw_ie = &session_entry->gLimWiderBWChannelSwitch; |
| 4012 | frm.WiderBWChanSwitchAnn.newChanWidth = |
| 4013 | wide_bw_ie->newChanWidth; |
| 4014 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = |
| 4015 | wide_bw_ie->newCenterChanFreq0; |
| 4016 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = |
| 4017 | wide_bw_ie->newCenterChanFreq1; |
| 4018 | frm.WiderBWChanSwitchAnn.present = 1; |
| 4019 | pe_debug("wrapper: width:%d f0:%d f1:%d", |
| 4020 | frm.WiderBWChanSwitchAnn.newChanWidth, |
| 4021 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0, |
| 4022 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1); |
| 4023 | } |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4024 | |
| 4025 | status = dot11f_get_packed_ext_channel_switch_action_frame_size(mac_ctx, |
| 4026 | &frm, &n_payload); |
| 4027 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4028 | pe_err("Failed to get packed size for Channel Switch 0x%08x", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4029 | status); |
| 4030 | /* We'll fall back on the worst case scenario*/ |
| 4031 | n_payload = sizeof(tDot11fext_channel_switch_action_frame); |
| 4032 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4033 | 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] | 4034 | status); |
| 4035 | } |
| 4036 | |
| 4037 | num_bytes = n_payload + sizeof(tSirMacMgmtHdr); |
| 4038 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4039 | qdf_status = cds_packet_alloc((uint16_t)num_bytes, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4040 | (void **) &frame, (void **) &packet); |
| 4041 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4042 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4043 | pe_err("Failed to allocate %d bytes for a Ext Channel Switch", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4044 | num_bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4045 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4046 | } |
| 4047 | |
| 4048 | /* Paranoia*/ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4049 | qdf_mem_zero(frame, num_bytes); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4050 | |
| 4051 | /* Next, we fill out the buffer descriptor */ |
| 4052 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4053 | SIR_MAC_MGMT_ACTION, peer, session_entry->self_mac_addr); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4054 | mac_hdr = (tpSirMacMgmtHdr) frame; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4055 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4056 | (uint8_t *) session_entry->bssId, |
| 4057 | sizeof(tSirMacAddr)); |
| 4058 | |
gaolez | 4b62a9e | 2018-08-16 15:57:50 +0800 | [diff] [blame] | 4059 | lim_set_protected_bit(mac_ctx, session_entry, peer, mac_hdr); |
| 4060 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4061 | status = dot11f_pack_ext_channel_switch_action_frame(mac_ctx, &frm, |
| 4062 | frame + sizeof(tSirMacMgmtHdr), n_payload, &n_payload); |
| 4063 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4064 | pe_err("Failed to pack a Channel Switch 0x%08x", status); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4065 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4066 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4067 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4068 | pe_warn("There were warnings while packing a Channel Switch 0x%08x", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4069 | status); |
| 4070 | } |
| 4071 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4072 | if (wlan_reg_is_5ghz_ch_freq(session_entry->curr_op_freq) || |
| 4073 | session_entry->opmode == QDF_P2P_CLIENT_MODE || |
| 4074 | session_entry->opmode == QDF_P2P_GO_MODE) |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4075 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4076 | |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 4077 | 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] | 4078 | QDF_MAC_ADDR_ARRAY(mac_hdr->da), |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4079 | frm.ext_chan_switch_ann_action.switch_count, |
| 4080 | frm.ext_chan_switch_ann_action.switch_mode, |
| 4081 | frm.ext_chan_switch_ann_action.new_channel, |
| 4082 | frm.ext_chan_switch_ann_action.op_class); |
| 4083 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4084 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4085 | session_entry->peSessionId, mac_hdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4086 | qdf_status = wma_tx_frame(mac_ctx, packet, (uint16_t) num_bytes, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4087 | TXRX_FRM_802_11_MGMT, |
| 4088 | ANI_TXDIR_TODS, |
| 4089 | 7, |
| 4090 | lim_tx_complete, frame, |
Abhishek Singh | 345be41 | 2019-11-19 10:59:29 +0530 | [diff] [blame] | 4091 | txFlag, vdev_id, 0, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4092 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4093 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4094 | session_entry->peSessionId, qdf_status)); |
| 4095 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4096 | pe_err("Failed to send a Ext Channel Switch %X!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4097 | qdf_status); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4098 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4099 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4100 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4101 | return QDF_STATUS_SUCCESS; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4102 | } /* End lim_send_extended_chan_switch_action_frame */ |
| 4103 | |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4104 | |
| 4105 | /** |
| 4106 | * lim_oper_chan_change_confirm_tx_complete_cnf()- Confirmation for oper_chan_change_confirm |
| 4107 | * sent over the air |
| 4108 | * |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 4109 | * @context: pointer to global mac |
| 4110 | * @buf: buffer |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4111 | * @tx_complete : Sent status |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 4112 | * @params: tx completion params |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4113 | * |
| 4114 | * Return: This returns QDF_STATUS |
| 4115 | */ |
| 4116 | |
| 4117 | static QDF_STATUS lim_oper_chan_change_confirm_tx_complete_cnf( |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 4118 | void *context, |
| 4119 | qdf_nbuf_t buf, |
| 4120 | uint32_t tx_complete, |
| 4121 | void *params) |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4122 | { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4123 | pe_debug("tx_complete: %d", tx_complete); |
Zhu Jianmin | 83e8b12 | 2018-05-18 19:24:45 +0800 | [diff] [blame] | 4124 | if (buf) |
| 4125 | qdf_nbuf_free(buf); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4126 | return QDF_STATUS_SUCCESS; |
| 4127 | } |
| 4128 | |
| 4129 | /** |
| 4130 | * lim_p2p_oper_chan_change_confirm_action_frame()- function to send |
| 4131 | * p2p oper chan change confirm action frame |
| 4132 | * @mac_ctx: pointer to global mac structure |
| 4133 | * @peer: Destination mac. |
| 4134 | * @session_entry: session entry |
| 4135 | * |
| 4136 | * This function is called to send p2p oper chan change confirm action frame. |
| 4137 | * |
| 4138 | * Return: success if frame is sent else return failure |
| 4139 | */ |
| 4140 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4141 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4142 | 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] | 4143 | tSirMacAddr peer, struct pe_session *session_entry) |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4144 | { |
| 4145 | tDot11fp2p_oper_chan_change_confirm frm; |
| 4146 | uint8_t *frame; |
| 4147 | tpSirMacMgmtHdr mac_hdr; |
| 4148 | uint32_t num_bytes, n_payload, status; |
| 4149 | void *packet; |
| 4150 | QDF_STATUS qdf_status; |
| 4151 | uint8_t tx_flag = 0; |
Abhishek Singh | 345be41 | 2019-11-19 10:59:29 +0530 | [diff] [blame] | 4152 | uint8_t vdev_id = 0; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4153 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4154 | if (!session_entry) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4155 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4156 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4157 | } |
| 4158 | |
Abhishek Singh | 345be41 | 2019-11-19 10:59:29 +0530 | [diff] [blame] | 4159 | vdev_id = session_entry->smeSessionId; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4160 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4161 | qdf_mem_zero(&frm, sizeof(frm)); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4162 | |
| 4163 | frm.Category.category = SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY; |
| 4164 | |
| 4165 | qdf_mem_copy(frm.p2p_action_oui.oui_data, |
| 4166 | SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE); |
| 4167 | frm.p2p_action_subtype.subtype = 0x04; |
| 4168 | frm.DialogToken.token = 0x0; |
| 4169 | |
| 4170 | if (session_entry->htCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4171 | pe_debug("Populate HT Caps in Assoc Request"); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4172 | populate_dot11f_ht_caps(mac_ctx, session_entry, &frm.HTCaps); |
| 4173 | } |
| 4174 | |
| 4175 | if (session_entry->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4176 | pe_debug("Populate VHT Caps in Assoc Request"); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4177 | populate_dot11f_vht_caps(mac_ctx, session_entry, &frm.VHTCaps); |
| 4178 | populate_dot11f_operating_mode(mac_ctx, |
| 4179 | &frm.OperatingMode, session_entry); |
| 4180 | } |
| 4181 | |
| 4182 | status = dot11f_get_packed_p2p_oper_chan_change_confirmSize(mac_ctx, |
| 4183 | &frm, &n_payload); |
| 4184 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4185 | pe_err("Failed to get packed size 0x%08x", status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4186 | /* We'll fall back on the worst case scenario*/ |
| 4187 | n_payload = sizeof(tDot11fp2p_oper_chan_change_confirm); |
| 4188 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4189 | pe_warn("There were warnings while calculating the packed size (0x%08x)", |
| 4190 | status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4191 | } |
| 4192 | |
| 4193 | num_bytes = n_payload + sizeof(tSirMacMgmtHdr); |
| 4194 | |
| 4195 | qdf_status = cds_packet_alloc((uint16_t)num_bytes, |
| 4196 | (void **) &frame, (void **) &packet); |
| 4197 | |
| 4198 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4199 | pe_err("Failed to allocate %d bytes", num_bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4200 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4201 | } |
| 4202 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4203 | qdf_mem_zero(frame, num_bytes); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4204 | |
| 4205 | /* Next, fill out the buffer descriptor */ |
| 4206 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4207 | SIR_MAC_MGMT_ACTION, peer, session_entry->self_mac_addr); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4208 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 4209 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
| 4210 | (uint8_t *) session_entry->bssId, |
| 4211 | sizeof(tSirMacAddr)); |
| 4212 | |
| 4213 | status = dot11f_pack_p2p_oper_chan_change_confirm(mac_ctx, &frm, |
| 4214 | frame + sizeof(tSirMacMgmtHdr), n_payload, &n_payload); |
| 4215 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4216 | pe_err("Failed to pack 0x%08x", status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4217 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4218 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4219 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4220 | pe_warn("There were warnings while packing 0x%08x", |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4221 | status); |
| 4222 | } |
| 4223 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4224 | if (wlan_reg_is_5ghz_ch_freq(session_entry->curr_op_freq) || |
| 4225 | session_entry->opmode == QDF_P2P_CLIENT_MODE || |
| 4226 | session_entry->opmode == QDF_P2P_GO_MODE) { |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4227 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4228 | } |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4229 | pe_debug("Send frame on channel freq %d to mac " |
| 4230 | QDF_MAC_ADDR_STR, session_entry->curr_op_freq, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 4231 | QDF_MAC_ADDR_ARRAY(peer)); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4232 | |
| 4233 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
| 4234 | session_entry->peSessionId, mac_hdr->fc.subType)); |
| 4235 | |
| 4236 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 4237 | (uint16_t)num_bytes, |
| 4238 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 4239 | 7, lim_tx_complete, frame, |
| 4240 | lim_oper_chan_change_confirm_tx_complete_cnf, |
Abhishek Singh | 345be41 | 2019-11-19 10:59:29 +0530 | [diff] [blame] | 4241 | tx_flag, vdev_id, false, 0, RATEID_DEFAULT); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4242 | |
| 4243 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 4244 | session_entry->peSessionId, qdf_status)); |
| 4245 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4246 | pe_err("Failed to send status %X!", qdf_status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4247 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4248 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4249 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4250 | return QDF_STATUS_SUCCESS; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 4251 | } |
| 4252 | |
| 4253 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4254 | /** |
| 4255 | * \brief Send a Neighbor Report Request Action frame |
| 4256 | * |
| 4257 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4258 | * \param mac Pointer to the global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4259 | * |
| 4260 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 4261 | * |
| 4262 | * \param peer mac address of peer station. |
| 4263 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4264 | * \param pe_session address of session entry. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4265 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4266 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4267 | * |
| 4268 | * |
| 4269 | */ |
| 4270 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4271 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4272 | lim_send_neighbor_report_request_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4273 | tpSirMacNeighborReportReq pNeighborReq, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4274 | tSirMacAddr peer, 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 | tDot11fNeighborReportRequest frm; |
| 4278 | uint8_t *pFrame; |
| 4279 | tpSirMacMgmtHdr pMacHdr; |
| 4280 | uint32_t nBytes, nPayload, nStatus; |
| 4281 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4282 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4283 | uint8_t txFlag = 0; |
| 4284 | uint8_t smeSessionId = 0; |
| 4285 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4286 | if (!pe_session) { |
| 4287 | pe_err("(!psession) in Request to send Neighbor Report request action frame"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4288 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4289 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4290 | smeSessionId = pe_session->smeSessionId; |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4291 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4292 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4293 | frm.Category.category = ACTION_CATEGORY_RRM; |
Srinivas Girigowda | 395addd | 2019-05-24 14:03:58 -0700 | [diff] [blame] | 4294 | frm.Action.action = RRM_NEIGHBOR_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4295 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 4296 | |
| 4297 | if (pNeighborReq->ssid_present) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4298 | populate_dot11f_ssid(mac, &pNeighborReq->ssid, &frm.SSID); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4299 | } |
| 4300 | |
| 4301 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4302 | dot11f_get_packed_neighbor_report_request_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4303 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4304 | 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] | 4305 | nStatus); |
| 4306 | /* We'll fall back on the worst case scenario: */ |
| 4307 | nPayload = sizeof(tDot11fNeighborReportRequest); |
| 4308 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4309 | pe_warn("There were warnings while calculating the packed size for a Neighbor Report Request(0x%08x)", |
| 4310 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4311 | } |
| 4312 | |
| 4313 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4314 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4315 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4316 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4317 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4318 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4319 | pe_err("Failed to allocate %d bytes for a Neighbor " |
| 4320 | "Report Request", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4321 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4322 | } |
| 4323 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4324 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4325 | |
| 4326 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4327 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4328 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4329 | |
| 4330 | /* Update A3 with the BSSID */ |
| 4331 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4332 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4333 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4334 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4335 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4336 | |
| 4337 | /* Now, we're ready to "pack" the frames */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4338 | nStatus = dot11f_pack_neighbor_report_request(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4339 | &frm, |
| 4340 | pFrame + |
| 4341 | sizeof(tSirMacMgmtHdr), |
| 4342 | nPayload, &nPayload); |
| 4343 | |
| 4344 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4345 | pe_err("Failed to pack an Neighbor Report Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4346 | nStatus); |
| 4347 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4348 | /* FIXME - Need to convert to QDF_STATUS */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4349 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4350 | goto returnAfterError; |
| 4351 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4352 | pe_warn("There were warnings while packing Neighbor Report Request (0x%08x)", |
| 4353 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4354 | } |
| 4355 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4356 | pe_debug("Sending a Neighbor Report Request to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4357 | lim_print_mac_addr(mac, peer, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4358 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4359 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 4360 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 4361 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4362 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4363 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4364 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4365 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4366 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4367 | pPacket, |
| 4368 | (uint16_t) nBytes, |
| 4369 | TXRX_FRM_802_11_MGMT, |
| 4370 | ANI_TXDIR_TODS, |
| 4371 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4372 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4373 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4374 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4375 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4376 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4377 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4378 | /* Pkt will be freed up by the callback */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4379 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4380 | } else |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4381 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4382 | |
| 4383 | returnAfterError: |
| 4384 | cds_packet_free((void *)pPacket); |
| 4385 | |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4386 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4387 | } /* End lim_send_neighbor_report_request_frame. */ |
| 4388 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4389 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4390 | lim_send_link_report_action_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4391 | tpSirMacLinkReport pLinkReport, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4392 | tSirMacAddr peer, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4393 | { |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4394 | QDF_STATUS status_code = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4395 | tDot11fLinkMeasurementReport frm; |
| 4396 | uint8_t *pFrame; |
| 4397 | tpSirMacMgmtHdr pMacHdr; |
| 4398 | uint32_t nBytes, nPayload, nStatus; |
| 4399 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4400 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4401 | uint8_t txFlag = 0; |
Pragaspathi Thilagaraj | 683c1cf | 2019-09-23 18:40:57 +0530 | [diff] [blame] | 4402 | uint8_t vdev_id = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4403 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4404 | if (!pe_session) { |
Pragaspathi Thilagaraj | 683c1cf | 2019-09-23 18:40:57 +0530 | [diff] [blame] | 4405 | pe_err("RRM: Send link report: NULL PE session"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4406 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4407 | } |
| 4408 | |
Pragaspathi Thilagaraj | 683c1cf | 2019-09-23 18:40:57 +0530 | [diff] [blame] | 4409 | vdev_id = pe_session->vdev_id; |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4410 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4411 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4412 | frm.Category.category = ACTION_CATEGORY_RRM; |
Srinivas Girigowda | 395addd | 2019-05-24 14:03:58 -0700 | [diff] [blame] | 4413 | frm.Action.action = RRM_LINK_MEASUREMENT_RPT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4414 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 4415 | |
| 4416 | /* IEEE Std. 802.11 7.3.2.18. for the report element. */ |
| 4417 | /* Even though TPC report an IE, it is represented using fixed fields since it is positioned */ |
| 4418 | /* in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 */ |
| 4419 | /* and frame parser always expects IEs to come after all fixed fields. It is easier to handle */ |
| 4420 | /* such case this way than changing the frame parser. */ |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 4421 | frm.TPCEleID.TPCId = WLAN_ELEMID_TPCREP; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4422 | frm.TPCEleLen.TPCLen = 2; |
| 4423 | frm.TxPower.txPower = pLinkReport->txPower; |
| 4424 | frm.LinkMargin.linkMargin = 0; |
| 4425 | |
| 4426 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 4427 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 4428 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 4429 | frm.RSNI.rsni = pLinkReport->rsni; |
| 4430 | |
| 4431 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4432 | dot11f_get_packed_link_measurement_report_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4433 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4434 | 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] | 4435 | /* We'll fall back on the worst case scenario: */ |
| 4436 | nPayload = sizeof(tDot11fLinkMeasurementReport); |
| 4437 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4438 | pe_warn("There were warnings while calculating the packed size for a Link Report (0x%08x)", |
| 4439 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4440 | } |
| 4441 | |
| 4442 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4443 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4444 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4445 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4446 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4447 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4448 | pe_err("Failed to allocate %d bytes for a Link " |
| 4449 | "Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4450 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4451 | } |
| 4452 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4453 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4454 | |
| 4455 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4456 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4457 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4458 | |
| 4459 | /* Update A3 with the BSSID */ |
| 4460 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4461 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4462 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4463 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4464 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4465 | |
| 4466 | /* Now, we're ready to "pack" the frames */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4467 | nStatus = dot11f_pack_link_measurement_report(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4468 | &frm, |
| 4469 | pFrame + |
| 4470 | sizeof(tSirMacMgmtHdr), |
| 4471 | nPayload, &nPayload); |
| 4472 | |
| 4473 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4474 | pe_err("Failed to pack an Link Report (0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4475 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4476 | /* FIXME - Need to convert to QDF_STATUS */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4477 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4478 | goto returnAfterError; |
| 4479 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4480 | pe_warn("There were warnings while packing Link Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4481 | nStatus); |
| 4482 | } |
| 4483 | |
Pragaspathi Thilagaraj | 683c1cf | 2019-09-23 18:40:57 +0530 | [diff] [blame] | 4484 | pe_warn("RRM: Sending Link Report to %pM on vdev[%d]", peer, vdev_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4485 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4486 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 4487 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 4488 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4489 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4490 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4491 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4492 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4493 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4494 | pPacket, |
| 4495 | (uint16_t) nBytes, |
| 4496 | TXRX_FRM_802_11_MGMT, |
| 4497 | ANI_TXDIR_TODS, |
| 4498 | 7, lim_tx_complete, pFrame, txFlag, |
Pragaspathi Thilagaraj | 683c1cf | 2019-09-23 18:40:57 +0530 | [diff] [blame] | 4499 | vdev_id, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4500 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4501 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4502 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4503 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4504 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4505 | /* Pkt will be freed up by the callback */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4506 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4507 | } else |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4508 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4509 | |
| 4510 | returnAfterError: |
| 4511 | cds_packet_free((void *)pPacket); |
| 4512 | |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4513 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4514 | } /* End lim_send_link_report_action_frame. */ |
| 4515 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4516 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4517 | lim_send_radio_measure_report_action_frame(struct mac_context *mac, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4518 | uint8_t dialog_token, |
| 4519 | uint8_t num_report, |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 4520 | bool is_last_frame, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4521 | tpSirMacRadioMeasureReport pRRMReport, |
| 4522 | tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4523 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4524 | { |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4525 | QDF_STATUS status_code = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4526 | uint8_t *pFrame; |
| 4527 | tpSirMacMgmtHdr pMacHdr; |
| 4528 | uint32_t nBytes, nPayload, nStatus; |
| 4529 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4530 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4531 | uint8_t i; |
| 4532 | uint8_t txFlag = 0; |
| 4533 | uint8_t smeSessionId = 0; |
Vignesh Viswanathan | 793328d | 2018-11-02 11:32:35 +0530 | [diff] [blame] | 4534 | bool is_last_report = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4535 | |
| 4536 | tDot11fRadioMeasurementReport *frm = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4537 | qdf_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 4538 | if (!frm) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4539 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4540 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4541 | if (!pe_session) { |
| 4542 | pe_err("(!psession) in Request to send Beacon Report action frame"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4543 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4544 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4545 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4546 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4547 | smeSessionId = pe_session->smeSessionId; |
Deepak Dhamdhere | 6a02148 | 2017-04-20 17:59:58 -0700 | [diff] [blame] | 4548 | |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 4549 | pe_debug("dialog_token %d num_report %d is_last_frame %d", |
| 4550 | dialog_token, num_report, is_last_frame); |
Padma, Santhosh Kumar | 93ec7d2 | 2016-12-26 15:58:37 +0530 | [diff] [blame] | 4551 | |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4552 | frm->Category.category = ACTION_CATEGORY_RRM; |
Srinivas Girigowda | 395addd | 2019-05-24 14:03:58 -0700 | [diff] [blame] | 4553 | frm->Action.action = RRM_RADIO_MEASURE_RPT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4554 | frm->DialogToken.token = dialog_token; |
| 4555 | |
| 4556 | frm->num_MeasurementReport = |
| 4557 | (num_report > |
| 4558 | RADIO_REPORTS_MAX_IN_A_FRAME) ? RADIO_REPORTS_MAX_IN_A_FRAME : |
| 4559 | num_report; |
| 4560 | |
| 4561 | for (i = 0; i < frm->num_MeasurementReport; i++) { |
| 4562 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 4563 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 4564 | frm->MeasurementReport[i].late = 0; /* IEEE 802.11k section 7.3.22. (always zero in rrm) */ |
| 4565 | switch (pRRMReport[i].type) { |
| 4566 | case SIR_MAC_RRM_BEACON_TYPE: |
Vignesh Viswanathan | 793328d | 2018-11-02 11:32:35 +0530 | [diff] [blame] | 4567 | /* |
| 4568 | * Last beacon report indication needs to be set to 1 |
| 4569 | * only for the last report in the last frame |
| 4570 | */ |
| 4571 | if (is_last_frame && |
| 4572 | (i == (frm->num_MeasurementReport - 1))) |
| 4573 | is_last_report = true; |
| 4574 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4575 | populate_dot11f_beacon_report(mac, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4576 | &frm->MeasurementReport[i], |
| 4577 | &pRRMReport[i].report. |
| 4578 | beaconReport, |
Vignesh Viswanathan | 793328d | 2018-11-02 11:32:35 +0530 | [diff] [blame] | 4579 | is_last_report); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4580 | frm->MeasurementReport[i].incapable = |
| 4581 | pRRMReport[i].incapable; |
| 4582 | frm->MeasurementReport[i].refused = |
| 4583 | pRRMReport[i].refused; |
| 4584 | frm->MeasurementReport[i].present = 1; |
| 4585 | break; |
| 4586 | default: |
| 4587 | frm->MeasurementReport[i].incapable = |
| 4588 | pRRMReport[i].incapable; |
| 4589 | frm->MeasurementReport[i].refused = |
| 4590 | pRRMReport[i].refused; |
| 4591 | frm->MeasurementReport[i].present = 1; |
| 4592 | break; |
| 4593 | } |
| 4594 | } |
| 4595 | |
| 4596 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4597 | dot11f_get_packed_radio_measurement_report_size(mac, frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4598 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4599 | 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] | 4600 | nStatus); |
| 4601 | /* We'll fall back on the worst case scenario: */ |
| 4602 | nPayload = sizeof(tDot11fLinkMeasurementReport); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4603 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4604 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4605 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4606 | pe_warn("There were warnings while calculating the packed size for a Radio Measure Report (0x%08x)", |
| 4607 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4608 | } |
| 4609 | |
| 4610 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4611 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4612 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4613 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4614 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4615 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4616 | pe_err("Failed to allocate %d bytes for a Radio Measure " |
| 4617 | "Report", nBytes); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4618 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4619 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4620 | } |
| 4621 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4622 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4623 | |
| 4624 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4625 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4626 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4627 | |
| 4628 | /* Update A3 with the BSSID */ |
| 4629 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4630 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4631 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4632 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4633 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4634 | |
| 4635 | /* Now, we're ready to "pack" the frames */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4636 | nStatus = dot11f_pack_radio_measurement_report(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4637 | frm, |
| 4638 | pFrame + |
| 4639 | sizeof(tSirMacMgmtHdr), |
| 4640 | nPayload, &nPayload); |
| 4641 | |
| 4642 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4643 | pe_err("Failed to pack an Radio Measure Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4644 | nStatus); |
| 4645 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4646 | /* FIXME - Need to convert to QDF_STATUS */ |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4647 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4648 | goto returnAfterError; |
| 4649 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4650 | pe_warn("There were warnings while packing Radio Measure Report (0x%08x)", |
| 4651 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4652 | } |
| 4653 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4654 | pe_warn("Sending a Radio Measure Report to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4655 | lim_print_mac_addr(mac, peer, LOGW); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4656 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4657 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 4658 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 4659 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4660 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4661 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4662 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4663 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4664 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4665 | pPacket, |
| 4666 | (uint16_t) nBytes, |
| 4667 | TXRX_FRM_802_11_MGMT, |
| 4668 | ANI_TXDIR_TODS, |
| 4669 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4670 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4671 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4672 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4673 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4674 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4675 | status_code = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4676 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4677 | qdf_mem_free(frm); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4678 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4679 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4680 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4681 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4682 | } |
| 4683 | |
| 4684 | returnAfterError: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4685 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4686 | cds_packet_free((void *)pPacket); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4687 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4688 | } |
| 4689 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4690 | #ifdef WLAN_FEATURE_11W |
| 4691 | /** |
| 4692 | * \brief Send SA query request action frame to peer |
| 4693 | * |
| 4694 | * \sa lim_send_sa_query_request_frame |
| 4695 | * |
| 4696 | * |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4697 | * \param mac The global struct mac_context *object |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4698 | * |
| 4699 | * \param transId Transaction identifier |
| 4700 | * |
| 4701 | * \param peer The Mac address of the station to which this action frame is addressed |
| 4702 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4703 | * \param pe_session The PE session entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4704 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4705 | * \return QDF_STATUS_SUCCESS if setup completes successfully |
| 4706 | * QDF_STATUS_E_FAILURE is some problem is encountered |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4707 | */ |
| 4708 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4709 | 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] | 4710 | tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4711 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4712 | { |
| 4713 | |
| 4714 | tDot11fSaQueryReq frm; /* SA query request action frame */ |
| 4715 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4716 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4717 | tpSirMacMgmtHdr pMacHdr; |
| 4718 | uint32_t nBytes, nPayload, nStatus; |
| 4719 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4720 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4721 | uint8_t txFlag = 0; |
| 4722 | uint8_t smeSessionId = 0; |
| 4723 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4724 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4725 | frm.Category.category = ACTION_CATEGORY_SA_QUERY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4726 | /* 11w action field is : |
| 4727 | action: 0 --> SA Query Request action frame |
| 4728 | action: 1 --> SA Query Response action frame */ |
Srinivas Girigowda | feb23fc | 2019-06-13 11:12:29 -0700 | [diff] [blame] | 4729 | frm.Action.action = SA_QUERY_REQUEST; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4730 | /* 11w SA Query Request transId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4731 | qdf_mem_copy(&frm.TransactionId.transId[0], &transId[0], 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4732 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4733 | nStatus = dot11f_get_packed_sa_query_req_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4734 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4735 | 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] | 4736 | nStatus); |
| 4737 | /* We'll fall back on the worst case scenario: */ |
| 4738 | nPayload = sizeof(tDot11fSaQueryReq); |
| 4739 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4740 | pe_warn("There were warnings while calculating the packed size for an SA Query Request (0x%08x)", |
| 4741 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4742 | } |
| 4743 | |
| 4744 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4745 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4746 | cds_packet_alloc(nBytes, (void **)&pFrame, (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4747 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4748 | pe_err("Failed to allocate %d bytes for a SA Query Request " |
| 4749 | "action frame", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4750 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4751 | } |
| 4752 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4753 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4754 | |
| 4755 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4756 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4757 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4758 | |
| 4759 | /* Update A3 with the BSSID */ |
| 4760 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4761 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4762 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4763 | |
| 4764 | /* Since this is a SA Query Request, set the "protect" (aka WEP) bit */ |
| 4765 | /* in the FC */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4766 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4767 | |
| 4768 | /* Pack 11w SA Query Request frame */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4769 | nStatus = dot11f_pack_sa_query_req(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4770 | &frm, |
| 4771 | pFrame + sizeof(tSirMacMgmtHdr), |
| 4772 | nPayload, &nPayload); |
| 4773 | |
| 4774 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4775 | pe_err("Failed to pack an SA Query Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4776 | nStatus); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4777 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4778 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4779 | goto returnAfterError; |
| 4780 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4781 | pe_warn("There were warnings while packing SA Query Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4782 | nStatus); |
| 4783 | } |
| 4784 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4785 | pe_debug("Sending an SA Query Request to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4786 | lim_print_mac_addr(mac, peer, LOGD); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4787 | pe_debug("Sending an SA Query Request from "); |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4788 | lim_print_mac_addr(mac, pe_session->self_mac_addr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4789 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4790 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 4791 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 4792 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4793 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 4794 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4795 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4796 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4797 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4798 | pPacket, |
| 4799 | (uint16_t) nBytes, |
| 4800 | TXRX_FRM_802_11_MGMT, |
| 4801 | ANI_TXDIR_TODS, |
| 4802 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4803 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4804 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4805 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4806 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4807 | /* Pkt will be freed up by the callback */ |
| 4808 | return nSirStatus; |
| 4809 | } else { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4810 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4811 | } |
| 4812 | |
| 4813 | returnAfterError: |
| 4814 | cds_packet_free((void *)pPacket); |
| 4815 | return nSirStatus; |
| 4816 | } /* End lim_send_sa_query_request_frame */ |
| 4817 | |
| 4818 | /** |
| 4819 | * \brief Send SA query response action frame to peer |
| 4820 | * |
| 4821 | * \sa lim_send_sa_query_response_frame |
| 4822 | * |
| 4823 | * |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4824 | * \param mac The global struct mac_context *object |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4825 | * |
| 4826 | * \param transId Transaction identifier received in SA query request action frame |
| 4827 | * |
| 4828 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 4829 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4830 | * \param pe_session The PE session entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4831 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4832 | * \return QDF_STATUS_SUCCESS if setup completes successfully |
| 4833 | * QDF_STATUS_E_FAILURE is some problem is encountered |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4834 | */ |
| 4835 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4836 | QDF_STATUS lim_send_sa_query_response_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4837 | uint8_t *transId, tSirMacAddr peer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4838 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4839 | { |
| 4840 | |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 4841 | tDot11fSaQueryRsp frm; /* SA query response action frame */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4842 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4843 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4844 | tpSirMacMgmtHdr pMacHdr; |
| 4845 | uint32_t nBytes, nPayload, nStatus; |
| 4846 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4847 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4848 | uint8_t txFlag = 0; |
| 4849 | uint8_t smeSessionId = 0; |
| 4850 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4851 | smeSessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4852 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4853 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 4854 | frm.Category.category = ACTION_CATEGORY_SA_QUERY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4855 | /*11w action field is : |
| 4856 | action: 0 --> SA query request action frame |
| 4857 | action: 1 --> SA query response action frame */ |
Srinivas Girigowda | feb23fc | 2019-06-13 11:12:29 -0700 | [diff] [blame] | 4858 | frm.Action.action = SA_QUERY_RESPONSE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4859 | /*11w SA query response transId is same as |
| 4860 | SA query request transId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4861 | qdf_mem_copy(&frm.TransactionId.transId[0], &transId[0], 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4862 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4863 | nStatus = dot11f_get_packed_sa_query_rsp_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4864 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4865 | 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] | 4866 | nStatus); |
| 4867 | /* We'll fall back on the worst case scenario: */ |
| 4868 | nPayload = sizeof(tDot11fSaQueryRsp); |
| 4869 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4870 | pe_warn("There were warnings while calculating the packed size for an SA Query Response (0x%08x)", |
| 4871 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4872 | } |
| 4873 | |
| 4874 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4875 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4876 | cds_packet_alloc(nBytes, (void **)&pFrame, (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4877 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4878 | pe_err("Failed to allocate %d bytes for a SA query response" |
| 4879 | " action frame", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4880 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4881 | } |
| 4882 | /* Paranoia: */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 4883 | qdf_mem_zero(pFrame, nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4884 | |
| 4885 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4886 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 4887 | SIR_MAC_MGMT_ACTION, peer, pe_session->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4888 | |
| 4889 | /* Update A3 with the BSSID */ |
| 4890 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4891 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4892 | sir_copy_mac_addr(pMacHdr->bssId, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4893 | |
| 4894 | /* Since this is a SA Query Response, set the "protect" (aka WEP) bit */ |
| 4895 | /* in the FC */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4896 | lim_set_protected_bit(mac, pe_session, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4897 | |
| 4898 | /* Pack 11w SA query response frame */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4899 | nStatus = dot11f_pack_sa_query_rsp(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4900 | &frm, |
| 4901 | pFrame + sizeof(tSirMacMgmtHdr), |
| 4902 | nPayload, &nPayload); |
| 4903 | |
| 4904 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4905 | pe_err("Failed to pack an SA Query Response (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4906 | nStatus); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4907 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4908 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4909 | goto returnAfterError; |
| 4910 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4911 | pe_warn("There were warnings while packing SA Query Response (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4912 | nStatus); |
| 4913 | } |
| 4914 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4915 | pe_debug("Sending a SA Query Response to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4916 | lim_print_mac_addr(mac, peer, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4917 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 4918 | if (wlan_reg_is_5ghz_ch_freq(pe_session->curr_op_freq) || |
| 4919 | pe_session->opmode == QDF_P2P_CLIENT_MODE || |
| 4920 | pe_session->opmode == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4921 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4922 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4923 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4924 | pe_session->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame] | 4925 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4926 | pPacket, |
| 4927 | (uint16_t) nBytes, |
| 4928 | TXRX_FRM_802_11_MGMT, |
| 4929 | ANI_TXDIR_TODS, |
| 4930 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4931 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4932 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4933 | pe_session->peSessionId, qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4934 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4935 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4936 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4937 | /* Pkt will be freed up by the callback */ |
| 4938 | return nSirStatus; |
| 4939 | } else { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4940 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4941 | } |
| 4942 | |
| 4943 | returnAfterError: |
| 4944 | cds_packet_free((void *)pPacket); |
| 4945 | return nSirStatus; |
| 4946 | } /* End lim_send_sa_query_response_frame */ |
| 4947 | #endif |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4948 | |
Manjunathappa Prakash | 458f6fe | 2019-05-13 18:33:01 -0700 | [diff] [blame] | 4949 | #if defined(QCA_WIFI_QCA6290) || defined(QCA_WIFI_QCA6390) || \ |
Alok Kumar | 2107a96 | 2020-01-13 15:35:29 +0530 | [diff] [blame^] | 4950 | defined(QCA_WIFI_QCA6490) || defined(QCA_WIFI_QCA6750) |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4951 | #ifdef WLAN_FEATURE_11AX |
Kiran Kumar Lokere | 9d80ef6 | 2019-10-15 17:02:49 -0700 | [diff] [blame] | 4952 | #define IS_PE_SESSION_HE_MODE(_session) ((_session)->he_capable) |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4953 | #else |
Kiran Kumar Lokere | 9d80ef6 | 2019-10-15 17:02:49 -0700 | [diff] [blame] | 4954 | #define IS_PE_SESSION_HE_MODE(_session) false |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4955 | #endif /* WLAN_FEATURE_11AX */ |
| 4956 | #else |
Kiran Kumar Lokere | 9d80ef6 | 2019-10-15 17:02:49 -0700 | [diff] [blame] | 4957 | #define IS_PE_SESSION_HE_MODE(_session) false |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 4958 | #endif |
| 4959 | |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4960 | /** |
| 4961 | * lim_send_addba_response_frame(): Send ADDBA response action frame to peer |
| 4962 | * @mac_ctx: mac context |
| 4963 | * @peer_mac: Peer MAC address |
| 4964 | * @tid: TID for which addba response is being sent |
| 4965 | * @session: PE session entry |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4966 | * @addba_extn_present: ADDBA extension present flag |
Kiran Kumar Lokere | aee823a | 2018-03-22 15:27:05 -0700 | [diff] [blame] | 4967 | * @amsdu_support: amsdu in ampdu support |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4968 | * |
| 4969 | * This function is called when ADDBA request is successful. ADDBA response is |
| 4970 | * setup by calling addba_response_setup API and frame is then sent out OTA. |
| 4971 | * |
| 4972 | * Return: QDF_STATUS |
| 4973 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4974 | 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] | 4975 | tSirMacAddr peer_mac, uint16_t tid, |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 4976 | struct pe_session *session, uint8_t addba_extn_present, |
Kiran Kumar Lokere | aee823a | 2018-03-22 15:27:05 -0700 | [diff] [blame] | 4977 | uint8_t amsdu_support) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4978 | { |
| 4979 | |
| 4980 | tDot11faddba_rsp frm; |
| 4981 | uint8_t *frame_ptr; |
| 4982 | tpSirMacMgmtHdr mgmt_hdr; |
| 4983 | uint32_t num_bytes, payload_size, status; |
Sandeep Puligilla | 39cec08 | 2018-04-30 15:18:45 -0700 | [diff] [blame] | 4984 | void *pkt_ptr = NULL; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4985 | QDF_STATUS qdf_status; |
| 4986 | uint8_t tx_flag = 0; |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 4987 | uint8_t vdev_id = 0; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4988 | uint16_t buff_size, status_code, batimeout; |
gaurank kathpalia | 8197e35 | 2019-09-11 16:09:53 +0530 | [diff] [blame] | 4989 | uint8_t dialog_token; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4990 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4991 | uint8_t he_frag = 0; |
Yu Wang | 36d5210 | 2019-09-20 12:08:04 +0800 | [diff] [blame] | 4992 | tpDphHashNode sta_ds; |
| 4993 | uint16_t aid; |
| 4994 | bool he_cap = false; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4995 | |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 4996 | vdev_id = session->vdev_id; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4997 | |
Vevek Venkatesan | 0ac759f | 2019-10-03 04:14:29 +0530 | [diff] [blame] | 4998 | cdp_addba_responsesetup(soc, peer_mac, vdev_id, tid, |
| 4999 | &dialog_token, &status_code, &buff_size, |
| 5000 | &batimeout); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5001 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 5002 | qdf_mem_zero((uint8_t *) &frm, sizeof(frm)); |
Srinivas Girigowda | 48bec1c | 2019-05-17 16:33:30 -0700 | [diff] [blame] | 5003 | frm.Category.category = ACTION_CATEGORY_BACK; |
Srinivas Girigowda | ef0d714 | 2019-05-17 17:07:47 -0700 | [diff] [blame] | 5004 | frm.Action.action = ADDBA_RESPONSE; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5005 | |
| 5006 | frm.DialogToken.token = dialog_token; |
| 5007 | frm.Status.status = status_code; |
Kiran Kumar Lokere | 08195ef | 2018-01-17 19:25:15 -0800 | [diff] [blame] | 5008 | if (mac_ctx->reject_addba_req) { |
| 5009 | frm.Status.status = eSIR_MAC_REQ_DECLINED_STATUS; |
| 5010 | pe_err("refused addba req"); |
| 5011 | } |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5012 | frm.addba_param_set.tid = tid; |
Yu Wang | 36d5210 | 2019-09-20 12:08:04 +0800 | [diff] [blame] | 5013 | |
| 5014 | if (lim_is_session_he_capable(session)) { |
| 5015 | sta_ds = dph_lookup_hash_entry(mac_ctx, peer_mac, &aid, |
| 5016 | &session->dph.dphHashTable); |
| 5017 | if (sta_ds) |
| 5018 | he_cap = lim_is_sta_he_capable(sta_ds); |
| 5019 | } |
| 5020 | |
| 5021 | if (he_cap) |
Kiran Kumar Lokere | 22f05d4 | 2019-06-28 18:33:43 -0700 | [diff] [blame] | 5022 | frm.addba_param_set.buff_size = MAX_BA_BUFF_SIZE; |
| 5023 | else |
| 5024 | frm.addba_param_set.buff_size = SIR_MAC_BA_DEFAULT_BUFF_SIZE; |
Yu Wang | 36d5210 | 2019-09-20 12:08:04 +0800 | [diff] [blame] | 5025 | |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 5026 | if (mac_ctx->usr_cfg_ba_buff_size) |
| 5027 | 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] | 5028 | |
| 5029 | if (frm.addba_param_set.buff_size > MAX_BA_BUFF_SIZE) |
| 5030 | frm.addba_param_set.buff_size = MAX_BA_BUFF_SIZE; |
| 5031 | |
| 5032 | if (frm.addba_param_set.buff_size > SIR_MAC_BA_DEFAULT_BUFF_SIZE) { |
| 5033 | if (session->active_ba_64_session) { |
| 5034 | frm.addba_param_set.buff_size = |
| 5035 | SIR_MAC_BA_DEFAULT_BUFF_SIZE; |
| 5036 | } |
| 5037 | } else if (!session->active_ba_64_session) { |
| 5038 | session->active_ba_64_session = true; |
| 5039 | } |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 5040 | |
Kiran Kumar Lokere | 9d80ef6 | 2019-10-15 17:02:49 -0700 | [diff] [blame] | 5041 | /* Enable RX AMSDU only in HE mode if supported */ |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 5042 | if (mac_ctx->is_usr_cfg_amsdu_enabled && |
Kiran Kumar Lokere | 9d80ef6 | 2019-10-15 17:02:49 -0700 | [diff] [blame] | 5043 | ((IS_PE_SESSION_HE_MODE(session) && |
| 5044 | WLAN_REG_IS_24GHZ_CH_FREQ(session->curr_op_freq)) || |
| 5045 | WLAN_REG_IS_5GHZ_CH_FREQ(session->curr_op_freq))) |
Arif Hussain | 0e24680 | 2018-05-01 18:13:44 -0700 | [diff] [blame] | 5046 | frm.addba_param_set.amsdu_supp = amsdu_support; |
| 5047 | else |
| 5048 | frm.addba_param_set.amsdu_supp = 0; |
Jinwei Chen | 332b5cf | 2019-03-05 13:26:17 +0800 | [diff] [blame] | 5049 | |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 5050 | frm.addba_param_set.policy = SIR_MAC_BA_POLICY_IMMEDIATE; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5051 | frm.ba_timeout.timeout = batimeout; |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 5052 | if (addba_extn_present) { |
| 5053 | frm.addba_extn_element.present = 1; |
| 5054 | frm.addba_extn_element.no_fragmentation = 1; |
| 5055 | if (lim_is_session_he_capable(session)) { |
| 5056 | he_frag = lim_get_session_he_frag_cap(session); |
| 5057 | if (he_frag != 0) { |
| 5058 | frm.addba_extn_element.no_fragmentation = 0; |
| 5059 | frm.addba_extn_element.he_frag_operation = |
| 5060 | he_frag; |
| 5061 | } |
| 5062 | } |
| 5063 | } |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5064 | |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 5065 | pe_debug("Sending a ADDBA Response from %pM to %pM", |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 5066 | session->self_mac_addr, peer_mac); |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 5067 | 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] | 5068 | tid, frm.DialogToken.token, frm.Status.status, |
| 5069 | frm.addba_param_set.buff_size); |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 5070 | pe_debug("addba_extn %d he_capable %d no_frag %d he_frag %d", |
| 5071 | addba_extn_present, |
| 5072 | lim_is_session_he_capable(session), |
| 5073 | frm.addba_extn_element.no_fragmentation, |
| 5074 | frm.addba_extn_element.he_frag_operation); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5075 | |
| 5076 | status = dot11f_get_packed_addba_rsp_size(mac_ctx, &frm, &payload_size); |
| 5077 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 5078 | 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] | 5079 | status); |
| 5080 | /* We'll fall back on the worst case scenario: */ |
| 5081 | payload_size = sizeof(tDot11faddba_rsp); |
| 5082 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 5083 | 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] | 5084 | } |
| 5085 | |
| 5086 | num_bytes = payload_size + sizeof(*mgmt_hdr); |
| 5087 | qdf_status = cds_packet_alloc(num_bytes, (void **)&frame_ptr, |
| 5088 | (void **)&pkt_ptr); |
Sandeep Puligilla | 39cec08 | 2018-04-30 15:18:45 -0700 | [diff] [blame] | 5089 | if (!QDF_IS_STATUS_SUCCESS(qdf_status) || (!pkt_ptr)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 5090 | pe_err("Failed to allocate %d bytes for a ADDBA response action frame", |
| 5091 | num_bytes); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5092 | return QDF_STATUS_E_FAILURE; |
| 5093 | } |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 5094 | qdf_mem_zero(frame_ptr, num_bytes); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5095 | |
| 5096 | lim_populate_mac_header(mac_ctx, frame_ptr, SIR_MAC_MGMT_FRAME, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 5097 | SIR_MAC_MGMT_ACTION, peer_mac, session->self_mac_addr); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5098 | |
| 5099 | /* Update A3 with the BSSID */ |
| 5100 | mgmt_hdr = (tpSirMacMgmtHdr) frame_ptr; |
| 5101 | sir_copy_mac_addr(mgmt_hdr->bssId, session->bssId); |
| 5102 | |
| 5103 | /* ADDBA Response is a robust mgmt action frame, |
| 5104 | * set the "protect" (aka WEP) bit in the FC |
| 5105 | */ |
| 5106 | lim_set_protected_bit(mac_ctx, session, peer_mac, mgmt_hdr); |
| 5107 | |
| 5108 | status = dot11f_pack_addba_rsp(mac_ctx, &frm, |
| 5109 | frame_ptr + sizeof(tSirMacMgmtHdr), payload_size, |
| 5110 | &payload_size); |
| 5111 | |
| 5112 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 5113 | pe_err("Failed to pack a ADDBA Response (0x%08x)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5114 | status); |
| 5115 | qdf_status = QDF_STATUS_E_FAILURE; |
| 5116 | goto error_addba_rsp; |
| 5117 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 5118 | pe_warn("There were warnings while packing ADDBA Response (0x%08x)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5119 | status); |
| 5120 | } |
| 5121 | |
| 5122 | |
Liangwei Dong | 419d730 | 2019-07-15 15:38:28 +0800 | [diff] [blame] | 5123 | if (wlan_reg_is_5ghz_ch_freq(session->curr_op_freq) || |
| 5124 | session->opmode == QDF_P2P_CLIENT_MODE || |
| 5125 | session->opmode == QDF_P2P_GO_MODE) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5126 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5127 | |
| 5128 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
| 5129 | session->peSessionId, mgmt_hdr->fc.subType)); |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 5130 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, pkt_ptr, |
| 5131 | (uint16_t)num_bytes, |
| 5132 | TXRX_FRM_802_11_MGMT, |
| 5133 | ANI_TXDIR_TODS, 7, |
| 5134 | NULL, frame_ptr, |
| 5135 | lim_addba_rsp_tx_complete_cnf, |
Abhishek Singh | cc02c9b | 2019-11-25 14:51:30 +0530 | [diff] [blame] | 5136 | tx_flag, vdev_id, |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 5137 | false, 0, RATEID_DEFAULT); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5138 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 5139 | session->peSessionId, qdf_status)); |
| 5140 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 5141 | pe_err("wma_tx_frame FAILED! Status [%d]", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5142 | qdf_status); |
chenguo | 90c6846 | 2019-01-24 18:27:01 +0800 | [diff] [blame] | 5143 | return QDF_STATUS_E_FAILURE; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5144 | } else { |
Tushnim Bhattacharyya | d58e4c9 | 2018-03-27 13:40:12 -0700 | [diff] [blame] | 5145 | return QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 5146 | } |
| 5147 | |
| 5148 | error_addba_rsp: |
| 5149 | cds_packet_free((void *)pkt_ptr); |
| 5150 | return qdf_status; |
| 5151 | } |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5152 | |
| 5153 | /** |
| 5154 | * lim_tx_mgmt_frame() - Transmits Auth mgmt frame |
| 5155 | * @mac_ctx Pointer to Global MAC structure |
| 5156 | * @mb_msg: Received message info |
| 5157 | * @msg_len: Received message length |
| 5158 | * @packet: Packet to be transmitted |
| 5159 | * @frame: Received frame |
| 5160 | * |
| 5161 | * Return: None |
| 5162 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 5163 | static void lim_tx_mgmt_frame(struct mac_context *mac_ctx, |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5164 | struct sir_mgmt_msg *mb_msg, uint32_t msg_len, |
| 5165 | void *packet, uint8_t *frame) |
| 5166 | { |
| 5167 | tpSirMacFrameCtl fc = (tpSirMacFrameCtl) mb_msg->data; |
| 5168 | QDF_STATUS qdf_status; |
Abhishek Singh | efe21e6 | 2019-09-20 10:03:24 +0530 | [diff] [blame] | 5169 | uint8_t vdev_id = 0; |
Jeff Johnson | a781565 | 2018-11-18 22:58:30 -0800 | [diff] [blame] | 5170 | struct pe_session *session; |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5171 | uint16_t auth_ack_status; |
| 5172 | enum rateid min_rid = RATEID_DEFAULT; |
| 5173 | |
Abhishek Singh | 345be41 | 2019-11-19 10:59:29 +0530 | [diff] [blame] | 5174 | vdev_id = mb_msg->vdev_id; |
Abhishek Singh | efe21e6 | 2019-09-20 10:03:24 +0530 | [diff] [blame] | 5175 | session = pe_find_session_by_vdev_id(mac_ctx, vdev_id); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 5176 | if (!session) { |
Wu Gao | 7c0a23f | 2019-03-12 14:16:37 +0800 | [diff] [blame] | 5177 | cds_packet_free((void *)packet); |
Abhishek Singh | efe21e6 | 2019-09-20 10:03:24 +0530 | [diff] [blame] | 5178 | pe_err("session not found for given vdev_id %d", |
| 5179 | vdev_id); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5180 | return; |
| 5181 | } |
| 5182 | |
Ashish Kumar Dhanotiya | 9f72df0 | 2018-07-23 19:20:04 +0530 | [diff] [blame] | 5183 | qdf_mtrace(QDF_MODULE_ID_PE, QDF_MODULE_ID_WMA, TRACE_CODE_TX_MGMT, |
| 5184 | session->peSessionId, 0); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5185 | |
| 5186 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_NOT_RCD; |
| 5187 | min_rid = lim_get_min_session_txrate(session); |
| 5188 | |
| 5189 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 5190 | (uint16_t)msg_len, |
| 5191 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 5192 | 7, lim_tx_complete, frame, |
| 5193 | lim_auth_tx_complete_cnf, |
Abhishek Singh | efe21e6 | 2019-09-20 10:03:24 +0530 | [diff] [blame] | 5194 | 0, vdev_id, false, 0, min_rid); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5195 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 5196 | session->peSessionId, qdf_status)); |
| 5197 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Rachit Kankane | 0baf6e7 | 2018-01-19 15:01:50 +0530 | [diff] [blame] | 5198 | pe_err("*** Could not send Auth frame (subType: %d), retCode=%X ***", |
| 5199 | fc->subType, qdf_status); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5200 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
| 5201 | auth_ack_status = SENT_FAIL; |
| 5202 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 5203 | session, auth_ack_status, QDF_STATUS_E_FAILURE); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5204 | /* Pkt will be freed up by the callback */ |
| 5205 | } |
| 5206 | } |
| 5207 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 5208 | void lim_send_mgmt_frame_tx(struct mac_context *mac_ctx, |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5209 | struct scheduler_msg *msg) |
| 5210 | { |
| 5211 | struct sir_mgmt_msg *mb_msg = (struct sir_mgmt_msg *)msg->bodyptr; |
| 5212 | uint32_t msg_len; |
| 5213 | tpSirMacFrameCtl fc = (tpSirMacFrameCtl) mb_msg->data; |
Abhishek Singh | 345be41 | 2019-11-19 10:59:29 +0530 | [diff] [blame] | 5214 | uint8_t vdev_id; |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5215 | QDF_STATUS qdf_status; |
| 5216 | uint8_t *frame; |
| 5217 | void *packet; |
Srinivas Dasari | 7621849 | 2019-01-22 15:08:20 +0530 | [diff] [blame] | 5218 | tpSirMacMgmtHdr mac_hdr; |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5219 | |
| 5220 | msg_len = mb_msg->msg_len - sizeof(*mb_msg); |
| 5221 | pe_debug("sending fc->type: %d fc->subType: %d", |
| 5222 | fc->type, fc->subType); |
| 5223 | |
Abhishek Singh | 345be41 | 2019-11-19 10:59:29 +0530 | [diff] [blame] | 5224 | vdev_id = mb_msg->vdev_id; |
Srinivas Dasari | 7621849 | 2019-01-22 15:08:20 +0530 | [diff] [blame] | 5225 | mac_hdr = (tpSirMacMgmtHdr)mb_msg->data; |
| 5226 | |
| 5227 | lim_add_mgmt_seq_num(mac_ctx, mac_hdr); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5228 | |
| 5229 | qdf_status = cds_packet_alloc((uint16_t) msg_len, (void **)&frame, |
| 5230 | (void **)&packet); |
| 5231 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 5232 | pe_err("call to bufAlloc failed for AUTH frame"); |
| 5233 | return; |
| 5234 | } |
| 5235 | |
| 5236 | qdf_mem_copy(frame, mb_msg->data, msg_len); |
| 5237 | |
| 5238 | lim_tx_mgmt_frame(mac_ctx, mb_msg, msg_len, packet, frame); |
| 5239 | } |