Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Zhu Jianmin | 5d8e3fe | 2018-01-04 16:16:20 +0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2018 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" |
| 30 | #include "cfg_api.h" |
| 31 | #include "utils_api.h" |
| 32 | #include "lim_types.h" |
| 33 | #include "lim_utils.h" |
| 34 | #include "lim_security_utils.h" |
| 35 | #include "lim_prop_exts_utils.h" |
| 36 | #include "dot11f.h" |
| 37 | #include "lim_sta_hash_api.h" |
| 38 | #include "sch_api.h" |
| 39 | #include "lim_send_messages.h" |
| 40 | #include "lim_assoc_utils.h" |
| 41 | #include "lim_ft.h" |
| 42 | #ifdef WLAN_FEATURE_11W |
| 43 | #include "wni_cfg.h" |
| 44 | #endif |
| 45 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 46 | #include "lim_ft_defs.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 47 | #include "lim_session.h" |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 48 | #include "qdf_types.h" |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 49 | #include "qdf_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 50 | #include "cds_utils.h" |
| 51 | #include "sme_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 52 | #include "rrm_api.h" |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 53 | #include "qdf_crypto.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 54 | |
| 55 | #include "wma_types.h" |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 56 | #include <cdp_txrx_cmn.h> |
Tushnim Bhattacharyya | 45ed04f | 2017-03-15 10:15:05 -0700 | [diff] [blame] | 57 | #include <cdp_txrx_peer_ops.h> |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 58 | #include "lim_process_fils.h" |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 59 | #include "wlan_utility.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 60 | |
| 61 | /** |
| 62 | * |
| 63 | * \brief This function is called to add the sequence number to the |
| 64 | * management frames |
| 65 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 66 | * \param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 67 | * |
| 68 | * \param pMacHdr Pointer to MAC management header |
| 69 | * |
| 70 | * The pMacHdr argument points to the MAC management header. The |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 71 | * sequence number stored in the mac structure will be incremented |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 72 | * and updated to the MAC management header. The start sequence |
| 73 | * number is WLAN_HOST_SEQ_NUM_MIN and the end value is |
| 74 | * WLAN_HOST_SEQ_NUM_MAX. After reaching the MAX value, the sequence |
| 75 | * number will roll over. |
| 76 | * |
| 77 | */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 78 | static void lim_add_mgmt_seq_num(tpAniSirGlobal mac, tpSirMacMgmtHdr pMacHdr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 79 | { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 80 | if (mac->mgmtSeqNum >= WLAN_HOST_SEQ_NUM_MAX) { |
| 81 | mac->mgmtSeqNum = WLAN_HOST_SEQ_NUM_MIN - 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 82 | } |
| 83 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 84 | mac->mgmtSeqNum++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 85 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 86 | pMacHdr->seqControl.seqNumLo = (mac->mgmtSeqNum & LOW_SEQ_NUM_MASK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 87 | pMacHdr->seqControl.seqNumHi = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 88 | ((mac->mgmtSeqNum & HIGH_SEQ_NUM_MASK) >> HIGH_SEQ_NUM_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | /** |
| 92 | * |
| 93 | * \brief This function is called before sending a p2p action frame |
| 94 | * inorder to add sequence numbers to action packets |
| 95 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 96 | * \param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 97 | * |
| 98 | * \param pBD Pointer to the frame buffer that needs to be populate |
| 99 | * |
| 100 | * The pMacHdr argument points to the MAC management header. The |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 101 | * sequence number stored in the mac structure will be incremented |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 102 | * and updated to the MAC management header. The start sequence |
| 103 | * number is WLAN_HOST_SEQ_NUM_MIN and the end value is |
| 104 | * WLAN_HOST_SEQ_NUM_MAX. After reaching the MAX value, the sequence |
| 105 | * number will roll over. |
| 106 | * |
| 107 | */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 108 | void lim_populate_p2p_mac_header(tpAniSirGlobal mac, uint8_t *pBD) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 109 | { |
| 110 | tpSirMacMgmtHdr pMacHdr; |
| 111 | |
| 112 | /* / Prepare MAC management header */ |
| 113 | pMacHdr = (tpSirMacMgmtHdr) (pBD); |
| 114 | |
| 115 | /* Prepare sequence number */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 116 | lim_add_mgmt_seq_num(mac, pMacHdr); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 117 | pe_debug("seqNumLo=%d, seqNumHi=%d, mgmtSeqNum=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 118 | pMacHdr->seqControl.seqNumLo, |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 119 | pMacHdr->seqControl.seqNumHi, mac->mgmtSeqNum); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | /** |
| 123 | * lim_populate_mac_header() - Fill in 802.11 header of frame |
| 124 | * |
| 125 | * @mac_ctx: Pointer to Global MAC structure |
| 126 | * @buf: Pointer to the frame buffer that needs to be populate |
| 127 | * @type: 802.11 Type of the frame |
| 128 | * @sub_type: 802.11 Subtype of the frame |
| 129 | * @peer_addr: dst address |
| 130 | * @self_mac_addr: local mac address |
| 131 | * |
| 132 | * This function is called by various LIM modules to prepare the |
| 133 | * 802.11 frame MAC header |
| 134 | * |
| 135 | * The buf argument points to the beginning of the frame buffer to |
| 136 | * which - a) The 802.11 MAC header is set b) Following this MAC header |
| 137 | * will be the MGMT frame payload The payload itself is populated by the |
| 138 | * caller API |
| 139 | * |
| 140 | * Return: None |
| 141 | */ |
| 142 | |
| 143 | void lim_populate_mac_header(tpAniSirGlobal mac_ctx, uint8_t *buf, |
| 144 | uint8_t type, uint8_t sub_type, tSirMacAddr peer_addr, |
| 145 | tSirMacAddr self_mac_addr) |
| 146 | { |
| 147 | tpSirMacMgmtHdr mac_hdr; |
| 148 | |
| 149 | /* Prepare MAC management header */ |
| 150 | mac_hdr = (tpSirMacMgmtHdr) (buf); |
| 151 | |
| 152 | /* Prepare FC */ |
| 153 | mac_hdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 154 | mac_hdr->fc.type = type; |
| 155 | mac_hdr->fc.subType = sub_type; |
| 156 | |
| 157 | /* Prepare Address 1 */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 158 | qdf_mem_copy((uint8_t *) mac_hdr->da, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 159 | (uint8_t *) peer_addr, sizeof(tSirMacAddr)); |
| 160 | |
| 161 | /* Prepare Address 2 */ |
| 162 | sir_copy_mac_addr(mac_hdr->sa, self_mac_addr); |
| 163 | |
| 164 | /* Prepare Address 3 */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 165 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 166 | (uint8_t *) peer_addr, sizeof(tSirMacAddr)); |
| 167 | |
| 168 | /* Prepare sequence number */ |
| 169 | lim_add_mgmt_seq_num(mac_ctx, mac_hdr); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 170 | pe_debug("seqNumLo=%d, seqNumHi=%d, mgmtSeqNum=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 171 | mac_hdr->seqControl.seqNumLo, |
| 172 | mac_hdr->seqControl.seqNumHi, mac_ctx->mgmtSeqNum); |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * lim_send_probe_req_mgmt_frame() - send probe request management frame |
| 177 | * @mac_ctx: Pointer to Global MAC structure |
| 178 | * @ssid: SSID to be sent in Probe Request frame |
| 179 | * @bssid: BSSID to be sent in Probe Request frame |
| 180 | * @channel: Channel # on which the Probe Request is going out |
| 181 | * @self_macaddr: self MAC address |
| 182 | * @dot11mode: self dotllmode |
| 183 | * @additional_ielen: if non-zero, include additional_ie in the Probe Request |
| 184 | * frame |
| 185 | * @additional_ie: if additional_ielen is non zero, include this field in the |
| 186 | * Probe Request frame |
| 187 | * |
| 188 | * This function is called by various LIM modules to send Probe Request frame |
| 189 | * during active scan/learn phase. |
| 190 | * Probe request is sent out in the following scenarios: |
| 191 | * --heartbeat failure: session needed |
| 192 | * --join req: session needed |
| 193 | * --foreground scan: no session |
| 194 | * --background scan: no session |
| 195 | * --sch_beacon_processing: to get EDCA parameters: session needed |
| 196 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 197 | * Return: QDF_STATUS (QDF_STATUS_SUCCESS on success and error codes otherwise) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 198 | */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 199 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 200 | lim_send_probe_req_mgmt_frame(tpAniSirGlobal mac_ctx, |
| 201 | tSirMacSSid *ssid, |
| 202 | tSirMacAddr bssid, |
| 203 | uint8_t channel, |
| 204 | tSirMacAddr self_macaddr, |
| 205 | uint32_t dot11mode, |
Sandeep Puligilla | 06ae890 | 2018-04-16 19:02:47 -0700 | [diff] [blame] | 206 | uint16_t *additional_ielen, uint8_t *additional_ie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 207 | { |
| 208 | tDot11fProbeRequest pr; |
| 209 | uint32_t status, bytes, payload; |
| 210 | uint8_t *frame; |
| 211 | void *packet; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 212 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 213 | tpPESession pesession; |
| 214 | uint8_t sessionid; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 215 | const uint8_t *p2pie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 216 | uint8_t txflag = 0; |
| 217 | uint8_t sme_sessionid = 0; |
| 218 | bool is_vht_enabled = false; |
| 219 | uint8_t txPower; |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 220 | uint16_t addn_ielen = 0; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 221 | bool extracted_ext_cap_flag = false; |
| 222 | tDot11fIEExtCap extracted_ext_cap; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 223 | QDF_STATUS sir_status; |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 224 | const uint8_t *qcn_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 225 | |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 226 | if (additional_ielen) |
| 227 | addn_ielen = *additional_ielen; |
| 228 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 229 | /* The probe req should not send 11ac capabilieties if band is 2.4GHz, |
| 230 | * unless enableVhtFor24GHz is enabled in INI. So if enableVhtFor24GHz |
| 231 | * is false and dot11mode is 11ac set it to 11n. |
| 232 | */ |
| 233 | if (channel <= SIR_11B_CHANNEL_END && |
Abhinav Kumar | e057b41 | 2018-10-09 17:28:16 +0530 | [diff] [blame] | 234 | !mac_ctx->mlme_cfg->vht_caps.vht_cap_info.b24ghz_band && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 235 | (WNI_CFG_DOT11_MODE_11AC == dot11mode || |
| 236 | WNI_CFG_DOT11_MODE_11AC_ONLY == dot11mode)) |
| 237 | dot11mode = WNI_CFG_DOT11_MODE_11N; |
| 238 | /* |
| 239 | * session context may or may not be present, when probe request needs |
| 240 | * to be sent out. Following cases exist: |
| 241 | * --heartbeat failure: session needed |
| 242 | * --join req: session needed |
| 243 | * --foreground scan: no session |
| 244 | * --background scan: no session |
| 245 | * --sch_beacon_processing: to get EDCA parameters: session needed |
| 246 | * If session context does not exist, some IEs will be populated from |
| 247 | * CFGs, e.g. Supported and Extended rate set IEs |
| 248 | */ |
| 249 | pesession = pe_find_session_by_bssid(mac_ctx, bssid, &sessionid); |
| 250 | |
| 251 | if (pesession != NULL) |
| 252 | sme_sessionid = pesession->smeSessionId; |
| 253 | |
| 254 | /* The scheme here is to fill out a 'tDot11fProbeRequest' structure */ |
| 255 | /* and then hand it off to 'dot11f_pack_probe_request' (for */ |
| 256 | /* serialization). We start by zero-initializing the structure: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 257 | qdf_mem_set((uint8_t *) &pr, sizeof(pr), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 258 | |
| 259 | /* & delegating to assorted helpers: */ |
| 260 | populate_dot11f_ssid(mac_ctx, ssid, &pr.SSID); |
| 261 | |
| 262 | if (addn_ielen && additional_ie) |
| 263 | p2pie = limGetP2pIEPtr(mac_ctx, additional_ie, addn_ielen); |
| 264 | |
| 265 | /* |
| 266 | * Don't include 11b rate if it is a P2P serach or probe request is |
| 267 | * sent by P2P Client |
| 268 | */ |
| 269 | if ((WNI_CFG_DOT11_MODE_11B != dot11mode) && (p2pie != NULL) && |
Abhishek Singh | 221cf99 | 2018-02-22 13:44:53 +0530 | [diff] [blame] | 270 | ((pesession != NULL) && |
| 271 | (QDF_P2P_CLIENT_MODE == pesession->pePersona))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 272 | /* |
| 273 | * In the below API pass channel number > 14, do that it fills |
| 274 | * only 11a rates in supported rates |
| 275 | */ |
| 276 | populate_dot11f_supp_rates(mac_ctx, 15, &pr.SuppRates, |
| 277 | pesession); |
| 278 | } else { |
| 279 | populate_dot11f_supp_rates(mac_ctx, channel, |
| 280 | &pr.SuppRates, pesession); |
| 281 | |
| 282 | if (WNI_CFG_DOT11_MODE_11B != dot11mode) { |
| 283 | populate_dot11f_ext_supp_rates1(mac_ctx, channel, |
| 284 | &pr.ExtSuppRates); |
| 285 | } |
| 286 | } |
| 287 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 288 | /* |
| 289 | * Table 7-14 in IEEE Std. 802.11k-2008 says |
| 290 | * DS params "can" be present in RRM is disabled and "is" present if |
| 291 | * RRM is enabled. It should be ok even if we add it into probe req when |
| 292 | * RRM is not enabled. |
| 293 | */ |
| 294 | populate_dot11f_ds_params(mac_ctx, &pr.DSParams, channel); |
| 295 | /* Call RRM module to get the tx power for management used. */ |
| 296 | txPower = (uint8_t) rrm_get_mgmt_tx_power(mac_ctx, pesession); |
| 297 | populate_dot11f_wfatpc(mac_ctx, &pr.WFATPC, txPower, 0); |
| 298 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 299 | |
| 300 | if (pesession != NULL) { |
| 301 | pesession->htCapability = IS_DOT11_MODE_HT(dot11mode); |
| 302 | /* Include HT Capability IE */ |
| 303 | if (pesession->htCapability) |
| 304 | populate_dot11f_ht_caps(mac_ctx, pesession, &pr.HTCaps); |
| 305 | } else { /* pesession == NULL */ |
| 306 | if (IS_DOT11_MODE_HT(dot11mode)) |
| 307 | populate_dot11f_ht_caps(mac_ctx, NULL, &pr.HTCaps); |
| 308 | } |
| 309 | |
| 310 | /* |
| 311 | * Set channelbonding information as "disabled" when tunned to a |
| 312 | * 2.4 GHz channel |
| 313 | */ |
| 314 | if (channel <= SIR_11B_CHANNEL_END) { |
| 315 | if (mac_ctx->roam.configParam.channelBondingMode24GHz |
| 316 | == PHY_SINGLE_CHANNEL_CENTERED) { |
| 317 | pr.HTCaps.supportedChannelWidthSet = |
| 318 | eHT_CHANNEL_WIDTH_20MHZ; |
| 319 | pr.HTCaps.shortGI40MHz = 0; |
| 320 | } else { |
| 321 | pr.HTCaps.supportedChannelWidthSet = |
| 322 | eHT_CHANNEL_WIDTH_40MHZ; |
| 323 | } |
| 324 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 325 | if (pesession != NULL) { |
| 326 | pesession->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); |
| 327 | /* Include VHT Capability IE */ |
| 328 | if (pesession->vhtCapability) { |
| 329 | populate_dot11f_vht_caps(mac_ctx, pesession, |
| 330 | &pr.VHTCaps); |
| 331 | is_vht_enabled = true; |
| 332 | } |
| 333 | } else { |
| 334 | if (IS_DOT11_MODE_VHT(dot11mode)) { |
| 335 | populate_dot11f_vht_caps(mac_ctx, pesession, |
| 336 | &pr.VHTCaps); |
| 337 | is_vht_enabled = true; |
| 338 | } |
| 339 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 340 | if (pesession != NULL) |
| 341 | populate_dot11f_ext_cap(mac_ctx, is_vht_enabled, &pr.ExtCap, |
| 342 | pesession); |
| 343 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 344 | if (IS_DOT11_MODE_HE(dot11mode) && NULL != pesession) |
| 345 | lim_update_session_he_capable(mac_ctx, pesession); |
| 346 | |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 347 | pe_debug("Populate HE IEs"); |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 348 | populate_dot11f_he_caps(mac_ctx, pesession, &pr.he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 349 | |
Sandeep Puligilla | 493fea2 | 2018-04-30 15:31:17 -0700 | [diff] [blame] | 350 | if (addn_ielen && additional_ie) { |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 351 | qdf_mem_zero((uint8_t *)&extracted_ext_cap, |
| 352 | sizeof(tDot11fIEExtCap)); |
| 353 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 354 | additional_ie, |
| 355 | &addn_ielen, |
| 356 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 357 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 358 | pe_debug("Unable to Stripoff ExtCap IE from Probe Req"); |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 359 | } else { |
| 360 | struct s_ext_cap *p_ext_cap = |
| 361 | (struct s_ext_cap *) |
| 362 | extracted_ext_cap.bytes; |
| 363 | if (p_ext_cap->interworking_service) |
| 364 | p_ext_cap->qos_map = 1; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 365 | extracted_ext_cap.num_bytes = |
| 366 | lim_compute_ext_cap_ie_length |
| 367 | (&extracted_ext_cap); |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 368 | extracted_ext_cap_flag = |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 369 | (extracted_ext_cap.num_bytes > 0); |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 370 | if (additional_ielen) |
| 371 | *additional_ielen = addn_ielen; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 372 | } |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 373 | qcn_ie = wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_QCN_OUI_TYPE, |
| 374 | SIR_MAC_QCN_OUI_TYPE_SIZE, |
| 375 | additional_ie, addn_ielen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 376 | } |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 377 | /* Add qcn_ie only if qcn ie is not present in additional_ie */ |
Wu Gao | 9381621 | 2018-08-31 16:49:54 +0800 | [diff] [blame] | 378 | if (mac_ctx->mlme_cfg->sta.qcn_ie_support && !qcn_ie) |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 379 | populate_dot11f_qcn_ie(&pr.QCN_IE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 380 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 381 | /* |
| 382 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 383 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 384 | * dot11f get packed payload size. |
| 385 | */ |
| 386 | if (extracted_ext_cap_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 387 | lim_merge_extcap_struct(&pr.ExtCap, &extracted_ext_cap, true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 388 | |
| 389 | /* That's it-- now we pack it. First, how much space are we going to */ |
| 390 | status = dot11f_get_packed_probe_request_size(mac_ctx, &pr, &payload); |
| 391 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 392 | 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] | 393 | status); |
| 394 | /* We'll fall back on the worst case scenario: */ |
| 395 | payload = sizeof(tDot11fProbeRequest); |
| 396 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 397 | 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] | 398 | status); |
| 399 | } |
| 400 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 401 | bytes = payload + sizeof(tSirMacMgmtHdr) + addn_ielen; |
| 402 | |
| 403 | /* Ok-- try to allocate some memory: */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 404 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 405 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 406 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 407 | pe_err("Failed to allocate %d bytes for a Probe Request", bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 408 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 409 | } |
| 410 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 411 | qdf_mem_set(frame, bytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 412 | |
| 413 | /* Next, we fill out the buffer descriptor: */ |
| 414 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 415 | SIR_MAC_MGMT_PROBE_REQ, bssid, self_macaddr); |
| 416 | |
| 417 | /* That done, pack the Probe Request: */ |
| 418 | status = dot11f_pack_probe_request(mac_ctx, &pr, frame + |
| 419 | sizeof(tSirMacMgmtHdr), |
| 420 | payload, &payload); |
| 421 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 422 | pe_err("Failed to pack a Probe Request (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 423 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 424 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 425 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 426 | 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] | 427 | } |
| 428 | /* Append any AddIE if present. */ |
| 429 | if (addn_ielen) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 430 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 431 | additional_ie, addn_ielen); |
| 432 | payload += addn_ielen; |
| 433 | } |
| 434 | |
| 435 | /* If this probe request is sent during P2P Search State, then we need |
| 436 | * to send it at OFDM rate. |
| 437 | */ |
Abhishek Singh | 221cf99 | 2018-02-22 13:44:53 +0530 | [diff] [blame] | 438 | if ((BAND_5G == lim_get_rf_band(channel)) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 439 | /* |
| 440 | * For unicast probe req mgmt from Join function we don't set |
| 441 | * above variables. So we need to add one more check whether it |
| 442 | * is pePersona is P2P_CLIENT or not |
| 443 | */ |
Abhishek Singh | 221cf99 | 2018-02-22 13:44:53 +0530 | [diff] [blame] | 444 | ((pesession != NULL) && |
| 445 | (QDF_P2P_CLIENT_MODE == pesession->pePersona))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 446 | txflag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 447 | } |
| 448 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 449 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 450 | wma_tx_frame(mac_ctx, packet, |
| 451 | (uint16_t) sizeof(tSirMacMgmtHdr) + payload, |
| 452 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
| 453 | lim_tx_complete, frame, txflag, sme_sessionid, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 454 | 0, RATEID_DEFAULT); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 455 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 456 | pe_err("could not send Probe Request frame!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 457 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 458 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 459 | } |
| 460 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 461 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 462 | } /* End lim_send_probe_req_mgmt_frame. */ |
| 463 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 464 | static QDF_STATUS lim_get_addn_ie_for_probe_resp(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 465 | uint8_t *addIE, uint16_t *addnIELen, |
| 466 | uint8_t probeReqP2pIe) |
| 467 | { |
| 468 | /* If Probe request doesn't have P2P IE, then take out P2P IE |
| 469 | from additional IE */ |
| 470 | if (!probeReqP2pIe) { |
| 471 | uint8_t *tempbuf = NULL; |
| 472 | uint16_t tempLen = 0; |
| 473 | int left = *addnIELen; |
| 474 | uint8_t *ptr = addIE; |
| 475 | uint8_t elem_id, elem_len; |
| 476 | |
| 477 | if (NULL == addIE) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 478 | pe_err("NULL addIE pointer"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 479 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 480 | } |
| 481 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 482 | tempbuf = qdf_mem_malloc(left); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 483 | if (!tempbuf) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 484 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 485 | |
| 486 | while (left >= 2) { |
| 487 | elem_id = ptr[0]; |
| 488 | elem_len = ptr[1]; |
| 489 | left -= 2; |
| 490 | if (elem_len > left) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 491 | pe_err("Invalid IEs eid: %d elem_len: %d left: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 492 | elem_id, elem_len, left); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 493 | qdf_mem_free(tempbuf); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 494 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 495 | } |
| 496 | if (!((SIR_MAC_EID_VENDOR == elem_id) && |
| 497 | (memcmp |
| 498 | (&ptr[2], SIR_MAC_P2P_OUI, |
| 499 | SIR_MAC_P2P_OUI_SIZE) == 0))) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 500 | qdf_mem_copy(tempbuf + tempLen, &ptr[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 501 | elem_len + 2); |
| 502 | tempLen += (elem_len + 2); |
| 503 | } |
| 504 | left -= elem_len; |
| 505 | ptr += (elem_len + 2); |
| 506 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 507 | qdf_mem_copy(addIE, tempbuf, tempLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 508 | *addnIELen = tempLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 509 | qdf_mem_free(tempbuf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 510 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 511 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 512 | } |
| 513 | |
| 514 | /** |
| 515 | * lim_send_probe_rsp_mgmt_frame() - Send probe response |
| 516 | * |
| 517 | * @mac_ctx: Handle for mac context |
| 518 | * @peer_macaddr: Mac address of requesting peer |
| 519 | * @ssid: SSID for response |
| 520 | * @n_staid: Station ID, currently unused. |
| 521 | * @pe_session: PE session id |
| 522 | * @keepalive: Keep alive flag. Currently unused. |
| 523 | * @preq_p2pie: P2P IE in incoming probe request |
| 524 | * |
| 525 | * Builds and sends probe response frame to the requesting peer |
| 526 | * |
| 527 | * Return: void |
| 528 | */ |
| 529 | |
| 530 | void |
| 531 | lim_send_probe_rsp_mgmt_frame(tpAniSirGlobal mac_ctx, |
| 532 | tSirMacAddr peer_macaddr, |
| 533 | tpAniSSID ssid, |
| 534 | short n_staid, |
| 535 | uint8_t keepalive, |
| 536 | tpPESession pe_session, uint8_t preq_p2pie) |
| 537 | { |
| 538 | tDot11fProbeResponse *frm; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 539 | QDF_STATUS sir_status; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 540 | uint32_t cfg, payload, bytes = 0, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 541 | tpSirMacMgmtHdr mac_hdr; |
| 542 | uint8_t *frame; |
Arif Hussain | fbf5068 | 2016-06-15 12:57:43 -0700 | [diff] [blame] | 543 | void *packet = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 544 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 545 | uint32_t addn_ie_present = false; |
| 546 | |
| 547 | uint16_t addn_ie_len = 0; |
gaurank kathpalia | 837f620 | 2018-09-14 21:55:32 +0530 | [diff] [blame] | 548 | bool wps_ap = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 549 | uint8_t tx_flag = 0; |
| 550 | uint8_t *add_ie = NULL; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 551 | const uint8_t *p2p_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 552 | uint8_t noalen = 0; |
| 553 | uint8_t total_noalen = 0; |
| 554 | uint8_t noa_stream[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
| 555 | uint8_t noa_ie[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
| 556 | uint8_t sme_sessionid = 0; |
| 557 | bool is_vht_enabled = false; |
Padma, Santhosh Kumar | 9223447 | 2017-04-19 18:20:02 +0530 | [diff] [blame] | 558 | tDot11fIEExtCap extracted_ext_cap = {0}; |
Selvaraj, Sridhar | 94ece20 | 2016-06-23 20:44:09 +0530 | [diff] [blame] | 559 | bool extracted_ext_cap_flag = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 560 | |
| 561 | /* We don't answer requests in this case*/ |
Srinivas Girigowda | 35b0031 | 2017-06-27 21:52:03 -0700 | [diff] [blame] | 562 | if (ANI_DRIVER_TYPE(mac_ctx) == QDF_DRIVER_TYPE_MFG) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 563 | return; |
| 564 | |
| 565 | if (NULL == pe_session) |
| 566 | return; |
| 567 | |
| 568 | /* |
| 569 | * In case when cac timer is running for this SAP session then |
| 570 | * avoid sending probe rsp out. It is violation of dfs specification. |
| 571 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 572 | if (((pe_session->pePersona == QDF_SAP_MODE) || |
| 573 | (pe_session->pePersona == QDF_P2P_GO_MODE)) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 574 | (true == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 575 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 576 | FL("CAC timer is running, probe response dropped")); |
| 577 | return; |
| 578 | } |
| 579 | sme_sessionid = pe_session->smeSessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 580 | frm = qdf_mem_malloc(sizeof(tDot11fProbeResponse)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 581 | if (!frm) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 582 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 583 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 584 | /* |
| 585 | * Fill out 'frm', after which we'll just hand the struct off to |
| 586 | * 'dot11f_pack_probe_response'. |
| 587 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 588 | qdf_mem_set((uint8_t *) frm, sizeof(tDot11fProbeResponse), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 589 | |
| 590 | /* |
| 591 | * Timestamp to be updated by TFP, below. |
| 592 | * |
| 593 | * Beacon Interval: |
| 594 | */ |
| 595 | if (LIM_IS_AP_ROLE(pe_session)) { |
| 596 | frm->BeaconInterval.interval = |
| 597 | mac_ctx->sch.schObject.gSchBeaconInterval; |
| 598 | } else { |
Bala Venkatesh | 2fde2c6 | 2018-09-11 20:33:24 +0530 | [diff] [blame] | 599 | cfg = mac_ctx->mlme_cfg->sap_cfg.beacon_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 600 | frm->BeaconInterval.interval = (uint16_t) cfg; |
| 601 | } |
| 602 | |
| 603 | populate_dot11f_capabilities(mac_ctx, &frm->Capabilities, pe_session); |
| 604 | populate_dot11f_ssid(mac_ctx, (tSirMacSSid *) ssid, &frm->SSID); |
| 605 | populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 606 | &frm->SuppRates, pe_session); |
| 607 | |
| 608 | populate_dot11f_ds_params(mac_ctx, &frm->DSParams, |
| 609 | pe_session->currentOperChannel); |
| 610 | populate_dot11f_ibss_params(mac_ctx, &frm->IBSSParams, pe_session); |
| 611 | |
| 612 | if (LIM_IS_AP_ROLE(pe_session)) { |
| 613 | if (pe_session->wps_state != SAP_WPS_DISABLED) |
| 614 | populate_dot11f_probe_res_wpsi_es(mac_ctx, |
| 615 | &frm->WscProbeRes, |
| 616 | pe_session); |
| 617 | } else { |
gaurank kathpalia | 837f620 | 2018-09-14 21:55:32 +0530 | [diff] [blame] | 618 | wps_ap = mac_ctx->mlme_cfg->wps_params.enable_wps & |
| 619 | WNI_CFG_WPS_ENABLE_AP; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 620 | if (wps_ap) |
| 621 | populate_dot11f_wsc_in_probe_res(mac_ctx, |
| 622 | &frm->WscProbeRes); |
| 623 | |
| 624 | if (mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState == |
| 625 | eLIM_WSC_ENROLL_BEGIN) { |
| 626 | populate_dot11f_wsc_registrar_info_in_probe_res(mac_ctx, |
| 627 | &frm->WscProbeRes); |
| 628 | mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState = |
| 629 | eLIM_WSC_ENROLL_IN_PROGRESS; |
| 630 | } |
| 631 | |
| 632 | if (mac_ctx->lim.wscIeInfo.wscEnrollmentState == |
| 633 | eLIM_WSC_ENROLL_END) { |
| 634 | de_populate_dot11f_wsc_registrar_info_in_probe_res( |
| 635 | mac_ctx, &frm->WscProbeRes); |
| 636 | mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState = |
| 637 | eLIM_WSC_ENROLL_NOOP; |
| 638 | } |
| 639 | } |
| 640 | |
| 641 | populate_dot11f_country(mac_ctx, &frm->Country, pe_session); |
| 642 | populate_dot11f_edca_param_set(mac_ctx, &frm->EDCAParamSet, pe_session); |
| 643 | |
| 644 | if (pe_session->dot11mode != WNI_CFG_DOT11_MODE_11B) |
| 645 | populate_dot11f_erp_info(mac_ctx, &frm->ERPInfo, pe_session); |
| 646 | |
| 647 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 648 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 649 | &frm->ExtSuppRates, pe_session); |
| 650 | |
| 651 | /* Populate HT IEs, when operating in 11n */ |
| 652 | if (pe_session->htCapability) { |
| 653 | populate_dot11f_ht_caps(mac_ctx, pe_session, &frm->HTCaps); |
| 654 | populate_dot11f_ht_info(mac_ctx, &frm->HTInfo, pe_session); |
| 655 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 656 | if (pe_session->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 657 | pe_debug("Populate VHT IE in Probe Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 658 | populate_dot11f_vht_caps(mac_ctx, pe_session, &frm->VHTCaps); |
| 659 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
| 660 | &frm->VHTOperation); |
| 661 | /* |
| 662 | * we do not support multi users yet. |
| 663 | * populate_dot11f_vht_ext_bss_load( mac_ctx, |
| 664 | * &frm.VHTExtBssLoad ); |
| 665 | */ |
| 666 | is_vht_enabled = true; |
| 667 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 668 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 669 | if (lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 670 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 671 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 672 | &frm->he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 673 | populate_dot11f_he_operation(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 674 | &frm->he_op); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 675 | } |
| 676 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 677 | populate_dot11f_ext_cap(mac_ctx, is_vht_enabled, &frm->ExtCap, |
| 678 | pe_session); |
| 679 | |
| 680 | if (pe_session->pLimStartBssReq) { |
| 681 | populate_dot11f_wpa(mac_ctx, |
| 682 | &(pe_session->pLimStartBssReq->rsnIE), |
| 683 | &frm->WPA); |
| 684 | populate_dot11f_rsn_opaque(mac_ctx, |
| 685 | &(pe_session->pLimStartBssReq->rsnIE), |
| 686 | &frm->RSNOpaque); |
| 687 | } |
| 688 | |
| 689 | populate_dot11f_wmm(mac_ctx, &frm->WMMInfoAp, &frm->WMMParams, |
| 690 | &frm->WMMCaps, pe_session); |
| 691 | |
| 692 | #if defined(FEATURE_WLAN_WAPI) |
| 693 | if (pe_session->pLimStartBssReq) |
| 694 | populate_dot11f_wapi(mac_ctx, |
| 695 | &(pe_session->pLimStartBssReq->rsnIE), |
| 696 | &frm->WAPI); |
| 697 | #endif /* defined(FEATURE_WLAN_WAPI) */ |
| 698 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 699 | if (mac_ctx->lim.gpLimRemainOnChanReq) |
| 700 | bytes += (mac_ctx->lim.gpLimRemainOnChanReq->length - |
| 701 | sizeof(tSirRemainOnChnReq)); |
| 702 | else |
| 703 | /* |
| 704 | * Only use CFG for non-listen mode. This CFG is not working for |
| 705 | * concurrency. In listening mode, probe rsp IEs is passed in |
| 706 | * the message from SME to PE. |
| 707 | */ |
| 708 | addn_ie_present = |
| 709 | (pe_session->addIeParams.probeRespDataLen != 0); |
| 710 | |
| 711 | if (addn_ie_present) { |
| 712 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 713 | add_ie = qdf_mem_malloc( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 714 | pe_session->addIeParams.probeRespDataLen); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 715 | if (!add_ie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 716 | goto err_ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 717 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 718 | qdf_mem_copy(add_ie, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 719 | pe_session->addIeParams.probeRespData_buff, |
| 720 | pe_session->addIeParams.probeRespDataLen); |
| 721 | addn_ie_len = pe_session->addIeParams.probeRespDataLen; |
| 722 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 723 | 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] | 724 | add_ie, &addn_ie_len, preq_p2pie)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 725 | pe_err("Unable to get addn_ie"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 726 | goto err_ret; |
| 727 | } |
| 728 | |
| 729 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 730 | add_ie, &addn_ie_len, |
| 731 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 732 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 733 | pe_debug("Unable to strip off ExtCap IE"); |
Selvaraj, Sridhar | 94ece20 | 2016-06-23 20:44:09 +0530 | [diff] [blame] | 734 | } else { |
| 735 | extracted_ext_cap_flag = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 736 | } |
| 737 | |
| 738 | bytes = bytes + addn_ie_len; |
| 739 | |
| 740 | if (preq_p2pie) |
| 741 | p2p_ie = limGetP2pIEPtr(mac_ctx, &add_ie[0], |
| 742 | addn_ie_len); |
| 743 | |
| 744 | if (p2p_ie != NULL) { |
| 745 | /* get NoA attribute stream P2P IE */ |
| 746 | noalen = lim_get_noa_attr_stream(mac_ctx, |
| 747 | noa_stream, pe_session); |
| 748 | if (noalen != 0) { |
| 749 | total_noalen = |
| 750 | lim_build_p2p_ie(mac_ctx, &noa_ie[0], |
| 751 | &noa_stream[0], noalen); |
| 752 | bytes = bytes + total_noalen; |
| 753 | } |
| 754 | } |
| 755 | } |
| 756 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 757 | /* |
| 758 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 759 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 760 | * dot11f get packed payload size. |
| 761 | */ |
| 762 | if (extracted_ext_cap_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 763 | lim_merge_extcap_struct(&frm->ExtCap, &extracted_ext_cap, |
| 764 | true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 765 | |
| 766 | status = dot11f_get_packed_probe_response_size(mac_ctx, frm, &payload); |
| 767 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 768 | pe_err("Probe Response size error (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 769 | status); |
| 770 | /* We'll fall back on the worst case scenario: */ |
| 771 | payload = sizeof(tDot11fProbeResponse); |
| 772 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 773 | pe_warn("Probe Response size warning (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 774 | status); |
| 775 | } |
| 776 | |
| 777 | bytes += payload + sizeof(tSirMacMgmtHdr); |
| 778 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 779 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 780 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 781 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 782 | pe_err("Probe Response allocation failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 783 | goto err_ret; |
| 784 | } |
| 785 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 786 | qdf_mem_set(frame, bytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 787 | |
| 788 | /* Next, we fill out the buffer descriptor: */ |
| 789 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 790 | SIR_MAC_MGMT_PROBE_RSP, peer_macaddr, |
| 791 | pe_session->selfMacAddr); |
| 792 | |
| 793 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 794 | |
| 795 | sir_copy_mac_addr(mac_hdr->bssId, pe_session->bssId); |
| 796 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 797 | /* That done, pack the Probe Response: */ |
| 798 | status = |
| 799 | dot11f_pack_probe_response(mac_ctx, frm, |
| 800 | frame + sizeof(tSirMacMgmtHdr), |
| 801 | payload, &payload); |
| 802 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 803 | pe_err("Probe Response pack failure (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 804 | status); |
| 805 | goto err_ret; |
| 806 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 807 | pe_warn("Probe Response pack warning (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 808 | } |
| 809 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 810 | pe_debug("Sending Probe Response frame to"); |
Nishank Aggarwal | 46bd31a | 2017-03-10 16:23:53 +0530 | [diff] [blame] | 811 | lim_print_mac_addr(mac_ctx, peer_macaddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 812 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 813 | if (mac_ctx->lim.gpLimRemainOnChanReq) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 814 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 815 | mac_ctx->lim.gpLimRemainOnChanReq->probeRspIe, |
| 816 | (mac_ctx->lim.gpLimRemainOnChanReq->length - |
| 817 | sizeof(tSirRemainOnChnReq))); |
| 818 | |
| 819 | if (addn_ie_present) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 820 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 821 | &add_ie[0], addn_ie_len); |
| 822 | |
| 823 | if (noalen != 0) { |
| 824 | if (total_noalen > |
| 825 | (SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 826 | pe_err("Not able to insert NoA, total len=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 827 | total_noalen); |
| 828 | goto err_ret; |
| 829 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 830 | qdf_mem_copy(&frame[bytes - (total_noalen)], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 831 | &noa_ie[0], total_noalen); |
| 832 | } |
| 833 | } |
| 834 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 835 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 836 | || (pe_session->pePersona == QDF_P2P_CLIENT_MODE) || |
| 837 | (pe_session->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 838 | ) |
| 839 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 840 | |
| 841 | /* Queue Probe Response frame in high priority WQ */ |
Jeff Johnson | 59429b0 | 2018-11-07 13:53:18 -0800 | [diff] [blame] | 842 | qdf_status = wma_tx_frame(mac_ctx, packet, |
| 843 | (uint16_t)bytes, |
| 844 | TXRX_FRM_802_11_MGMT, |
| 845 | ANI_TXDIR_TODS, |
| 846 | 7, lim_tx_complete, frame, tx_flag, |
| 847 | sme_sessionid, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 848 | |
| 849 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 850 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 851 | pe_err("Could not send Probe Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 852 | |
| 853 | if (add_ie != NULL) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 854 | qdf_mem_free(add_ie); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 855 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 856 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 857 | return; |
| 858 | |
| 859 | err_ret: |
| 860 | if (add_ie != NULL) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 861 | qdf_mem_free(add_ie); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 862 | if (frm != NULL) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 863 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 864 | if (packet != NULL) |
| 865 | cds_packet_free((void *)packet); |
| 866 | return; |
| 867 | |
| 868 | } /* End lim_send_probe_rsp_mgmt_frame. */ |
| 869 | |
| 870 | void |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 871 | lim_send_addts_req_action_frame(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 872 | tSirMacAddr peerMacAddr, |
| 873 | tSirAddtsReqInfo *pAddTS, tpPESession psessionEntry) |
| 874 | { |
| 875 | uint16_t i; |
| 876 | uint8_t *pFrame; |
| 877 | tDot11fAddTSRequest AddTSReq; |
| 878 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 879 | uint32_t nPayload, nBytes, nStatus; |
| 880 | tpSirMacMgmtHdr pMacHdr; |
| 881 | void *pPacket; |
| 882 | #ifdef FEATURE_WLAN_ESE |
| 883 | uint32_t phyMode; |
| 884 | #endif |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 885 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 886 | uint8_t txFlag = 0; |
| 887 | uint8_t smeSessionId = 0; |
| 888 | |
| 889 | if (NULL == psessionEntry) { |
| 890 | return; |
| 891 | } |
| 892 | |
| 893 | smeSessionId = psessionEntry->smeSessionId; |
| 894 | |
| 895 | if (!pAddTS->wmeTspecPresent) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 896 | qdf_mem_set((uint8_t *) &AddTSReq, sizeof(AddTSReq), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 897 | |
| 898 | AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 899 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 900 | AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 901 | if (pAddTS->lleTspecPresent) { |
| 902 | populate_dot11f_tspec(&pAddTS->tspec, &AddTSReq.TSPEC); |
| 903 | } else { |
| 904 | populate_dot11f_wmmtspec(&pAddTS->tspec, |
| 905 | &AddTSReq.WMMTSPEC); |
| 906 | } |
| 907 | |
| 908 | if (pAddTS->lleTspecPresent) { |
| 909 | AddTSReq.num_WMMTCLAS = 0; |
| 910 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 911 | for (i = 0; i < pAddTS->numTclas; ++i) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 912 | populate_dot11f_tclas(mac, &pAddTS->tclasInfo[i], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 913 | &AddTSReq.TCLAS[i]); |
| 914 | } |
| 915 | } else { |
| 916 | AddTSReq.num_TCLAS = 0; |
| 917 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 918 | for (i = 0; i < pAddTS->numTclas; ++i) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 919 | populate_dot11f_wmmtclas(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 920 | &pAddTS->tclasInfo[i], |
| 921 | &AddTSReq.WMMTCLAS[i]); |
| 922 | } |
| 923 | } |
| 924 | |
| 925 | if (pAddTS->tclasProcPresent) { |
| 926 | if (pAddTS->lleTspecPresent) { |
| 927 | AddTSReq.TCLASSPROC.processing = |
| 928 | pAddTS->tclasProc; |
| 929 | AddTSReq.TCLASSPROC.present = 1; |
| 930 | } else { |
| 931 | AddTSReq.WMMTCLASPROC.version = 1; |
| 932 | AddTSReq.WMMTCLASPROC.processing = |
| 933 | pAddTS->tclasProc; |
| 934 | AddTSReq.WMMTCLASPROC.present = 1; |
| 935 | } |
| 936 | } |
| 937 | |
| 938 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 939 | dot11f_get_packed_add_ts_request_size(mac, &AddTSReq, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 940 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 941 | pe_err("Failed to calculate the packed size for an Add TS Request (0x%08x)", |
| 942 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 943 | /* We'll fall back on the worst case scenario: */ |
| 944 | nPayload = sizeof(tDot11fAddTSRequest); |
| 945 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 946 | pe_warn("There were warnings while calculating the packed size for an Add TS Request (0x%08x)", |
| 947 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 948 | } |
| 949 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 950 | qdf_mem_set((uint8_t *) &WMMAddTSReq, sizeof(WMMAddTSReq), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 951 | |
| 952 | WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 953 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 954 | WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME; |
| 955 | |
| 956 | /* WMM spec 2.2.10 - status code is only filled in for ADDTS response */ |
| 957 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 958 | |
| 959 | populate_dot11f_wmmtspec(&pAddTS->tspec, &WMMAddTSReq.WMMTSPEC); |
| 960 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 961 | lim_get_phy_mode(mac, &phyMode, psessionEntry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 962 | |
| 963 | if (phyMode == WNI_CFG_PHY_MODE_11G |
| 964 | || phyMode == WNI_CFG_PHY_MODE_11A) { |
| 965 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 966 | } else { |
| 967 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 968 | } |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 969 | populate_dot11_tsrsie(mac, &pAddTS->tsrsIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 970 | &WMMAddTSReq.ESETrafStrmRateSet, |
| 971 | sizeof(uint8_t)); |
| 972 | #endif |
| 973 | /* fillWmeTspecIE */ |
| 974 | |
| 975 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 976 | dot11f_get_packed_wmm_add_ts_request_size(mac, &WMMAddTSReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 977 | &nPayload); |
| 978 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 979 | 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] | 980 | nStatus); |
| 981 | /* We'll fall back on the worst case scenario: */ |
| 982 | nPayload = sizeof(tDot11fAddTSRequest); |
| 983 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 984 | pe_warn("There were warnings while calculating the packed size for a WMM Add TS Request (0x%08x)", |
| 985 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 986 | } |
| 987 | } |
| 988 | |
| 989 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 990 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 991 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 992 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 993 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 994 | pe_err("Failed to allocate %d bytes for an Add TS Request", |
| 995 | nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 996 | return; |
| 997 | } |
| 998 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 999 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1000 | |
| 1001 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1002 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1003 | SIR_MAC_MGMT_ACTION, peerMacAddr, psessionEntry->selfMacAddr); |
| 1004 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 1005 | |
| 1006 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 1007 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1008 | lim_set_protected_bit(mac, psessionEntry, peerMacAddr, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1009 | |
| 1010 | /* That done, pack the struct: */ |
| 1011 | if (!pAddTS->wmeTspecPresent) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1012 | nStatus = dot11f_pack_add_ts_request(mac, &AddTSReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1013 | pFrame + |
| 1014 | sizeof(tSirMacMgmtHdr), |
| 1015 | nPayload, &nPayload); |
| 1016 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1017 | pe_err("Failed to pack an Add TS Request " |
| 1018 | "(0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1019 | cds_packet_free((void *)pPacket); |
| 1020 | return; /* allocated! */ |
| 1021 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1022 | pe_warn("There were warnings while packing an Add TS Request (0x%08x)", |
| 1023 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1024 | } |
| 1025 | } else { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1026 | nStatus = dot11f_pack_wmm_add_ts_request(mac, &WMMAddTSReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1027 | pFrame + |
| 1028 | sizeof(tSirMacMgmtHdr), |
| 1029 | nPayload, &nPayload); |
| 1030 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1031 | pe_err("Failed to pack a WMM Add TS Request (0x%08x)", |
| 1032 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1033 | cds_packet_free((void *)pPacket); |
| 1034 | return; /* allocated! */ |
| 1035 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1036 | pe_warn("There were warnings while packing a WMM Add TS Request (0x%08x)", |
| 1037 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1038 | } |
| 1039 | } |
| 1040 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1041 | pe_debug("Sending an Add TS Request frame to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1042 | lim_print_mac_addr(mac, peerMacAddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1043 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1044 | if ((BAND_5G == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1045 | lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1046 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) |
| 1047 | || (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1048 | ) { |
| 1049 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1050 | } |
| 1051 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1052 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1053 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1054 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1055 | psessionEntry, QDF_STATUS_SUCCESS, |
| 1056 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1057 | |
| 1058 | /* Queue Addts Response frame in high priority WQ */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1059 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1060 | TXRX_FRM_802_11_MGMT, |
| 1061 | ANI_TXDIR_TODS, |
| 1062 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1063 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1064 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1065 | psessionEntry->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1066 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1067 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 1068 | pe_err("Could not send an Add TS Request (%X", |
| 1069 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1070 | } /* End lim_send_addts_req_action_frame. */ |
| 1071 | |
| 1072 | /** |
| 1073 | * lim_send_assoc_rsp_mgmt_frame() - Send assoc response |
| 1074 | * @mac_ctx: Handle for mac context |
| 1075 | * @status_code: Status code for assoc response frame |
| 1076 | * @aid: Association ID |
| 1077 | * @peer_addr: Mac address of requesting peer |
| 1078 | * @subtype: Assoc/Reassoc |
| 1079 | * @sta: Pointer to station node |
| 1080 | * @pe_session: PE session id. |
| 1081 | * |
| 1082 | * Builds and sends association response frame to the requesting peer. |
| 1083 | * |
| 1084 | * Return: void |
| 1085 | */ |
| 1086 | |
| 1087 | void |
| 1088 | lim_send_assoc_rsp_mgmt_frame(tpAniSirGlobal mac_ctx, |
| 1089 | uint16_t status_code, uint16_t aid, tSirMacAddr peer_addr, |
| 1090 | uint8_t subtype, tpDphHashNode sta, tpPESession pe_session) |
| 1091 | { |
| 1092 | static tDot11fAssocResponse frm; |
| 1093 | uint8_t *frame; |
| 1094 | tpSirMacMgmtHdr mac_hdr; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1095 | QDF_STATUS sir_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1096 | uint8_t lle_mode = 0, addts; |
| 1097 | tHalBitVal qos_mode, wme_mode; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1098 | uint32_t payload, bytes = 0, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1099 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1100 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1101 | tUpdateBeaconParams beacon_params; |
| 1102 | uint8_t tx_flag = 0; |
| 1103 | uint32_t addn_ie_len = 0; |
| 1104 | uint8_t add_ie[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1105 | tpSirAssocReq assoc_req = NULL; |
| 1106 | uint8_t sme_session = 0; |
| 1107 | bool is_vht = false; |
| 1108 | uint16_t stripoff_len = 0; |
| 1109 | tDot11fIEExtCap extracted_ext_cap; |
| 1110 | bool extracted_flag = false; |
| 1111 | #ifdef WLAN_FEATURE_11W |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 1112 | uint8_t retry_int; |
| 1113 | uint16_t max_retries; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1114 | #endif |
| 1115 | |
| 1116 | if (NULL == pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1117 | pe_err("pe_session is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1118 | return; |
| 1119 | } |
| 1120 | |
| 1121 | sme_session = pe_session->smeSessionId; |
| 1122 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1123 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1124 | |
| 1125 | limGetQosMode(pe_session, &qos_mode); |
| 1126 | limGetWmeMode(pe_session, &wme_mode); |
| 1127 | |
| 1128 | /* |
| 1129 | * An Add TS IE is added only if the AP supports it and |
| 1130 | * the requesting STA sent a traffic spec. |
| 1131 | */ |
| 1132 | addts = (qos_mode && sta && sta->qos.addtsPresent) ? 1 : 0; |
| 1133 | |
| 1134 | frm.Status.status = status_code; |
| 1135 | |
| 1136 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1137 | |
| 1138 | if (NULL == sta) { |
| 1139 | populate_dot11f_supp_rates(mac_ctx, |
| 1140 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1141 | &frm.SuppRates, pe_session); |
| 1142 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 1143 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1144 | &frm.ExtSuppRates, pe_session); |
| 1145 | } else { |
| 1146 | populate_dot11f_assoc_rsp_rates(mac_ctx, &frm.SuppRates, |
| 1147 | &frm.ExtSuppRates, |
| 1148 | sta->supportedRates.llbRates, |
| 1149 | sta->supportedRates.llaRates); |
| 1150 | } |
| 1151 | |
| 1152 | if (LIM_IS_AP_ROLE(pe_session) && sta != NULL && |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1153 | QDF_STATUS_SUCCESS == status_code) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1154 | assoc_req = (tpSirAssocReq) |
| 1155 | pe_session->parsedAssocReq[sta->assocId]; |
| 1156 | /* |
| 1157 | * populate P2P IE in AssocRsp when assocReq from the peer |
| 1158 | * includes P2P IE |
| 1159 | */ |
| 1160 | if (assoc_req != NULL && assoc_req->addIEPresent) |
| 1161 | populate_dot11_assoc_res_p2p_ie(mac_ctx, |
| 1162 | &frm.P2PAssocRes, |
| 1163 | assoc_req); |
| 1164 | } |
| 1165 | |
| 1166 | if (NULL != sta) { |
| 1167 | if (eHAL_SET == qos_mode) { |
| 1168 | if (sta->lleEnabled) { |
| 1169 | lle_mode = 1; |
| 1170 | populate_dot11f_edca_param_set(mac_ctx, |
| 1171 | &frm.EDCAParamSet, pe_session); |
| 1172 | } |
| 1173 | } |
| 1174 | |
| 1175 | if ((!lle_mode) && (eHAL_SET == wme_mode) && sta->wmeEnabled) { |
| 1176 | populate_dot11f_wmm_params(mac_ctx, &frm.WMMParams, |
| 1177 | pe_session); |
| 1178 | |
| 1179 | if (sta->wsmEnabled) |
| 1180 | populate_dot11f_wmm_caps(&frm.WMMCaps); |
| 1181 | } |
| 1182 | |
| 1183 | if (sta->mlmStaContext.htCapability && |
| 1184 | pe_session->htCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1185 | pe_debug("Populate HT IEs in Assoc Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1186 | populate_dot11f_ht_caps(mac_ctx, pe_session, |
| 1187 | &frm.HTCaps); |
Krunal Soni | ef3294b | 2015-06-12 15:12:19 -0700 | [diff] [blame] | 1188 | /* |
| 1189 | * Check the STA capability and |
| 1190 | * update the HTCaps accordingly |
| 1191 | */ |
| 1192 | frm.HTCaps.supportedChannelWidthSet = ( |
| 1193 | sta->htSupportedChannelWidthSet < |
| 1194 | pe_session->htSupportedChannelWidthSet) ? |
| 1195 | sta->htSupportedChannelWidthSet : |
| 1196 | pe_session->htSupportedChannelWidthSet; |
| 1197 | if (!frm.HTCaps.supportedChannelWidthSet) |
| 1198 | frm.HTCaps.shortGI40MHz = 0; |
| 1199 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1200 | populate_dot11f_ht_info(mac_ctx, &frm.HTInfo, |
| 1201 | pe_session); |
| 1202 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1203 | 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] | 1204 | frm.HTCaps.supportedChannelWidthSet, |
| 1205 | frm.HTCaps.mimoPowerSave, |
| 1206 | frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, |
| 1207 | frm.HTCaps.shortGI40MHz, |
| 1208 | frm.HTCaps.dsssCckMode40MHz, |
| 1209 | frm.HTCaps.maxRxAMPDUFactor); |
| 1210 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1211 | if (sta->mlmStaContext.vhtCapability && |
| 1212 | pe_session->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1213 | pe_debug("Populate VHT IEs in Assoc Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1214 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
| 1215 | &frm.VHTCaps); |
| 1216 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1217 | &frm.VHTOperation); |
| 1218 | is_vht = true; |
| 1219 | } |
Naveen Rawat | 903acca | 2017-09-15 17:32:13 -0700 | [diff] [blame] | 1220 | |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1221 | if (pe_session->vhtCapability && |
| 1222 | pe_session->vendor_vht_sap && |
| 1223 | (assoc_req != NULL) && |
| 1224 | assoc_req->vendor_vht_ie.VHTCaps.present) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1225 | pe_debug("Populate Vendor VHT IEs in Assoc Rsponse"); |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1226 | frm.vendor_vht_ie.present = 1; |
Kiran Kumar Lokere | 8172263 | 2017-09-26 12:11:43 -0700 | [diff] [blame] | 1227 | frm.vendor_vht_ie.sub_type = |
| 1228 | pe_session->vendor_specific_vht_ie_sub_type; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1229 | frm.vendor_vht_ie.VHTCaps.present = 1; |
| 1230 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
| 1231 | &frm.vendor_vht_ie.VHTCaps); |
Kiran Kumar Lokere | cc44868 | 2017-07-20 18:08:01 -0700 | [diff] [blame] | 1232 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
| 1233 | &frm.vendor_vht_ie.VHTOperation); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1234 | is_vht = true; |
| 1235 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1236 | populate_dot11f_ext_cap(mac_ctx, is_vht, &frm.ExtCap, |
| 1237 | pe_session); |
| 1238 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1239 | if (lim_is_sta_he_capable(sta) && |
| 1240 | lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1241 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1242 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1243 | &frm.he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1244 | populate_dot11f_he_operation(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1245 | &frm.he_op); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1246 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1247 | #ifdef WLAN_FEATURE_11W |
| 1248 | if (eSIR_MAC_TRY_AGAIN_LATER == status_code) { |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 1249 | max_retries = |
| 1250 | mac_ctx->mlme_cfg->gen.pmf_sa_query_max_retries; |
| 1251 | retry_int = |
| 1252 | mac_ctx->mlme_cfg->gen.pmf_sa_query_retry_interval; |
| 1253 | populate_dot11f_timeout_interval(mac_ctx, |
| 1254 | &frm.TimeoutInterval, |
| 1255 | SIR_MAC_TI_TYPE_ASSOC_COMEBACK, |
| 1256 | (max_retries - |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1257 | sta->pmfSaQueryRetryCount) |
| 1258 | * retry_int); |
| 1259 | } |
| 1260 | #endif |
Arif Hussain | 0c81692 | 2017-04-06 15:04:44 -0700 | [diff] [blame] | 1261 | |
| 1262 | if (LIM_IS_AP_ROLE(pe_session) && sta->non_ecsa_capable) |
| 1263 | pe_session->lim_non_ecsa_cap_num++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1264 | } |
| 1265 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1266 | qdf_mem_set((uint8_t *) &beacon_params, sizeof(beacon_params), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1267 | |
| 1268 | if (LIM_IS_AP_ROLE(pe_session) && |
Pragaspathi Thilagaraj | 1ee7600 | 2018-09-18 21:38:51 +0530 | [diff] [blame] | 1269 | (pe_session->gLimProtectionControl != |
| 1270 | MLME_FORCE_POLICY_PROTECTION_DISABLE)) |
| 1271 | lim_decide_ap_protection(mac_ctx, peer_addr, &beacon_params, |
| 1272 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1273 | |
| 1274 | lim_update_short_preamble(mac_ctx, peer_addr, &beacon_params, |
| 1275 | pe_session); |
| 1276 | lim_update_short_slot_time(mac_ctx, peer_addr, &beacon_params, |
| 1277 | pe_session); |
| 1278 | |
| 1279 | /* |
| 1280 | * Populate Do11capabilities after updating session with |
| 1281 | * Assos req details |
| 1282 | */ |
| 1283 | populate_dot11f_capabilities(mac_ctx, &frm.Capabilities, pe_session); |
| 1284 | |
| 1285 | beacon_params.bssIdx = pe_session->bssIdx; |
| 1286 | |
| 1287 | /* Send message to HAL about beacon parameter change. */ |
| 1288 | if ((false == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running) |
| 1289 | && beacon_params.paramChangeBitmap) { |
| 1290 | sch_set_fixed_beacon_fields(mac_ctx, pe_session); |
| 1291 | lim_send_beacon_params(mac_ctx, &beacon_params, pe_session); |
| 1292 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1293 | |
Arif Hussain | 1513cb2 | 2018-01-05 19:56:31 -0800 | [diff] [blame] | 1294 | lim_obss_send_detection_cfg(mac_ctx, pe_session, false); |
| 1295 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1296 | if (assoc_req != NULL) { |
Krishna Kumaar Natarajan | e4e3a14 | 2016-04-01 16:27:51 -0700 | [diff] [blame] | 1297 | addn_ie_len = pe_session->addIeParams.assocRespDataLen; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1298 | |
| 1299 | /* Nonzero length indicates Assoc rsp IE available */ |
Krishna Kumaar Natarajan | e4e3a14 | 2016-04-01 16:27:51 -0700 | [diff] [blame] | 1300 | if (addn_ie_len > 0 && |
| 1301 | addn_ie_len <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && |
| 1302 | (bytes + addn_ie_len) <= SIR_MAX_PACKET_SIZE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1303 | qdf_mem_copy(add_ie, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1304 | pe_session->addIeParams.assocRespData_buff, |
| 1305 | pe_session->addIeParams.assocRespDataLen); |
| 1306 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1307 | qdf_mem_set((uint8_t *) &extracted_ext_cap, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1308 | sizeof(extracted_ext_cap), 0); |
| 1309 | |
| 1310 | stripoff_len = addn_ie_len; |
| 1311 | sir_status = |
| 1312 | lim_strip_extcap_update_struct |
| 1313 | (mac_ctx, &add_ie[0], &stripoff_len, |
| 1314 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1315 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1316 | pe_debug("strip off extcap IE failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1317 | } else { |
| 1318 | addn_ie_len = stripoff_len; |
| 1319 | extracted_flag = true; |
| 1320 | } |
| 1321 | bytes = bytes + addn_ie_len; |
| 1322 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1323 | pe_debug("addn_ie_len: %d for Assoc Resp: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1324 | addn_ie_len, assoc_req->addIEPresent); |
| 1325 | } |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1326 | |
| 1327 | /* |
| 1328 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 1329 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 1330 | * dot11f get packed payload size. |
| 1331 | */ |
| 1332 | if (extracted_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1333 | lim_merge_extcap_struct(&(frm.ExtCap), &extracted_ext_cap, |
| 1334 | true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1335 | |
| 1336 | /* Allocate a buffer for this frame: */ |
| 1337 | status = dot11f_get_packed_assoc_response_size(mac_ctx, &frm, &payload); |
| 1338 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1339 | pe_err("get Association Response size failure (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1340 | status); |
| 1341 | return; |
| 1342 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1343 | pe_warn("get Association Response size warning (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1344 | status); |
| 1345 | } |
| 1346 | |
| 1347 | bytes += sizeof(tSirMacMgmtHdr) + payload; |
| 1348 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1349 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1350 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1351 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1352 | pe_err("cds_packet_alloc failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1353 | return; |
| 1354 | } |
| 1355 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1356 | qdf_mem_set(frame, bytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1357 | |
| 1358 | /* Next, we fill out the buffer descriptor: */ |
| 1359 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 1360 | (LIM_ASSOC == subtype) ? |
| 1361 | SIR_MAC_MGMT_ASSOC_RSP : SIR_MAC_MGMT_REASSOC_RSP, |
| 1362 | peer_addr, |
| 1363 | pe_session->selfMacAddr); |
| 1364 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 1365 | |
| 1366 | sir_copy_mac_addr(mac_hdr->bssId, pe_session->bssId); |
| 1367 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1368 | status = dot11f_pack_assoc_response(mac_ctx, &frm, |
| 1369 | frame + sizeof(tSirMacMgmtHdr), |
| 1370 | payload, &payload); |
| 1371 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1372 | pe_err("Association Response pack failure(0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1373 | status); |
| 1374 | cds_packet_free((void *)packet); |
| 1375 | return; |
| 1376 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1377 | pe_warn("Association Response pack warning (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1378 | status); |
| 1379 | } |
| 1380 | |
| 1381 | if (subtype == LIM_ASSOC) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1382 | pe_debug("*** Sending Assoc Resp status %d aid %d to", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1383 | status_code, aid); |
| 1384 | else |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1385 | pe_debug("*** Sending ReAssoc Resp status %d aid %d to", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1386 | status_code, aid); |
| 1387 | |
Abhishek Singh | 5d8d733 | 2017-08-10 15:15:24 +0530 | [diff] [blame] | 1388 | lim_print_mac_addr(mac_ctx, mac_hdr->da, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1389 | |
| 1390 | 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] | 1391 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1392 | &add_ie[0], addn_ie_len); |
| 1393 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1394 | if ((BAND_5G == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1395 | lim_get_rf_band(pe_session->currentOperChannel)) || |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1396 | (pe_session->pePersona == QDF_P2P_CLIENT_MODE) || |
| 1397 | (pe_session->pePersona == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1398 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1399 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1400 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1401 | pe_session->peSessionId, mac_hdr->fc.subType)); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 1402 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1403 | pe_session, QDF_STATUS_SUCCESS, status_code); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1404 | /* Queue Association Response frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1405 | qdf_status = wma_tx_frame(mac_ctx, packet, (uint16_t) bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1406 | TXRX_FRM_802_11_MGMT, |
| 1407 | ANI_TXDIR_TODS, |
| 1408 | 7, lim_tx_complete, frame, tx_flag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1409 | sme_session, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1410 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1411 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1412 | |
| 1413 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1414 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1415 | pe_err("Could not Send Re/AssocRsp, retCode=%X", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1416 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1417 | |
| 1418 | /* |
| 1419 | * update the ANI peer station count. |
| 1420 | * FIXME_PROTECTION : take care of different type of station |
| 1421 | * counter inside this function. |
| 1422 | */ |
| 1423 | lim_util_count_sta_add(mac_ctx, sta, pe_session); |
| 1424 | |
| 1425 | } |
| 1426 | |
| 1427 | void |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1428 | lim_send_delts_req_action_frame(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1429 | tSirMacAddr peer, |
| 1430 | uint8_t wmmTspecPresent, |
| 1431 | tSirMacTSInfo *pTsinfo, |
| 1432 | tSirMacTspecIE *pTspecIe, tpPESession psessionEntry) |
| 1433 | { |
| 1434 | uint8_t *pFrame; |
| 1435 | tpSirMacMgmtHdr pMacHdr; |
| 1436 | tDot11fDelTS DelTS; |
| 1437 | tDot11fWMMDelTS WMMDelTS; |
| 1438 | uint32_t nBytes, nPayload, nStatus; |
| 1439 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1440 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1441 | uint8_t txFlag = 0; |
| 1442 | uint8_t smeSessionId = 0; |
| 1443 | |
| 1444 | if (NULL == psessionEntry) { |
| 1445 | return; |
| 1446 | } |
| 1447 | |
| 1448 | smeSessionId = psessionEntry->smeSessionId; |
| 1449 | |
| 1450 | if (!wmmTspecPresent) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1451 | qdf_mem_set((uint8_t *) &DelTS, sizeof(DelTS), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1452 | |
| 1453 | DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1454 | DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 1455 | populate_dot11f_ts_info(pTsinfo, &DelTS.TSInfo); |
| 1456 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1457 | nStatus = dot11f_get_packed_del_ts_size(mac, &DelTS, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1458 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1459 | pe_err("Failed to calculate the packed size for a Del TS (0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1460 | /* We'll fall back on the worst case scenario: */ |
| 1461 | nPayload = sizeof(tDot11fDelTS); |
| 1462 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1463 | pe_warn("There were warnings while calculating the packed size for a Del TS (0x%08x)", |
| 1464 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1465 | } |
| 1466 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1467 | qdf_mem_set((uint8_t *) &WMMDelTS, sizeof(WMMDelTS), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1468 | |
| 1469 | WMMDelTS.Category.category = SIR_MAC_ACTION_WME; |
| 1470 | WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 1471 | WMMDelTS.DialogToken.token = 0; |
| 1472 | WMMDelTS.StatusCode.statusCode = 0; |
| 1473 | populate_dot11f_wmmtspec(pTspecIe, &WMMDelTS.WMMTSPEC); |
| 1474 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1475 | dot11f_get_packed_wmm_del_ts_size(mac, &WMMDelTS, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1476 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1477 | pe_err("Failed to calculate the packed size for a WMM Del TS (0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1478 | /* We'll fall back on the worst case scenario: */ |
| 1479 | nPayload = sizeof(tDot11fDelTS); |
| 1480 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1481 | pe_warn("There were warnings while calculating the packed size for a WMM Del TS (0x%08x)", |
| 1482 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1483 | } |
| 1484 | } |
| 1485 | |
| 1486 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 1487 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1488 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1489 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 1490 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1491 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1492 | pe_err("Failed to allocate %d bytes for an Add TS Response", |
| 1493 | nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1494 | return; |
| 1495 | } |
| 1496 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1497 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1498 | |
| 1499 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1500 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1501 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 1502 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 1503 | |
| 1504 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 1505 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1506 | lim_set_protected_bit(mac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1507 | |
| 1508 | /* That done, pack the struct: */ |
| 1509 | if (!wmmTspecPresent) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1510 | nStatus = dot11f_pack_del_ts(mac, &DelTS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1511 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1512 | nPayload, &nPayload); |
| 1513 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1514 | pe_err("Failed to pack a Del TS frame (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1515 | nStatus); |
| 1516 | cds_packet_free((void *)pPacket); |
| 1517 | return; /* allocated! */ |
| 1518 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1519 | pe_warn("There were warnings while packing a Del TS frame (0x%08x)", |
| 1520 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1521 | } |
| 1522 | } else { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1523 | nStatus = dot11f_pack_wmm_del_ts(mac, &WMMDelTS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1524 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1525 | nPayload, &nPayload); |
| 1526 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1527 | pe_err("Failed to pack a WMM Del TS frame (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1528 | nStatus); |
| 1529 | cds_packet_free((void *)pPacket); |
| 1530 | return; /* allocated! */ |
| 1531 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1532 | pe_warn("There were warnings while packing a WMM Del TS frame (0x%08x)", |
| 1533 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1534 | } |
| 1535 | } |
| 1536 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1537 | pe_debug("Sending DELTS REQ (size %d) to ", nBytes); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1538 | lim_print_mac_addr(mac, pMacHdr->da, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1539 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1540 | if ((BAND_5G == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1541 | lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1542 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) |
| 1543 | || (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1544 | ) { |
| 1545 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1546 | } |
| 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 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1550 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1551 | psessionEntry, QDF_STATUS_SUCCESS, |
| 1552 | QDF_STATUS_SUCCESS); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 1553 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1554 | TXRX_FRM_802_11_MGMT, |
| 1555 | ANI_TXDIR_TODS, |
| 1556 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1557 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1558 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1559 | psessionEntry->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1560 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1561 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1562 | pe_err("Failed to send Del TS (%X)!", qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1563 | |
| 1564 | } /* End lim_send_delts_req_action_frame. */ |
| 1565 | |
| 1566 | /** |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1567 | * lim_assoc_tx_complete_cnf()- Confirmation for assoc sent over the air |
| 1568 | * @context: pointer to global mac |
| 1569 | * @buf: buffer |
| 1570 | * @tx_complete : Sent status |
| 1571 | * @params; tx completion params |
| 1572 | * |
| 1573 | * Return: This returns QDF_STATUS |
| 1574 | */ |
| 1575 | |
| 1576 | static QDF_STATUS lim_assoc_tx_complete_cnf(void *context, |
| 1577 | qdf_nbuf_t buf, |
| 1578 | uint32_t tx_complete, |
| 1579 | void *params) |
| 1580 | { |
| 1581 | uint16_t assoc_ack_status; |
| 1582 | uint16_t reason_code; |
| 1583 | tpAniSirGlobal mac_ctx = (tpAniSirGlobal)context; |
| 1584 | |
| 1585 | pe_debug("tx_complete= %d", tx_complete); |
Zhu Jianmin | 5d8e3fe | 2018-01-04 16:16:20 +0800 | [diff] [blame] | 1586 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) { |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1587 | assoc_ack_status = ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1588 | reason_code = QDF_STATUS_SUCCESS; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1589 | } else { |
| 1590 | assoc_ack_status = NOT_ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1591 | reason_code = QDF_STATUS_E_FAILURE; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1592 | } |
| 1593 | if (buf) |
| 1594 | qdf_nbuf_free(buf); |
| 1595 | |
| 1596 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_ACK_EVENT, |
| 1597 | NULL, assoc_ack_status, reason_code); |
| 1598 | return QDF_STATUS_SUCCESS; |
| 1599 | } |
| 1600 | |
| 1601 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1602 | * lim_send_assoc_req_mgmt_frame() - Send association request |
| 1603 | * @mac_ctx: Handle to MAC context |
| 1604 | * @mlm_assoc_req: Association request information |
| 1605 | * @pe_session: PE session information |
| 1606 | * |
| 1607 | * Builds and transmits association request frame to AP. |
| 1608 | * |
| 1609 | * Return: Void |
| 1610 | */ |
| 1611 | |
| 1612 | void |
| 1613 | lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx, |
| 1614 | tLimMlmAssocReq *mlm_assoc_req, |
| 1615 | tpPESession pe_session) |
| 1616 | { |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 1617 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1618 | tDot11fAssocRequest *frm; |
| 1619 | uint16_t caps; |
| 1620 | uint8_t *frame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1621 | QDF_STATUS sir_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1622 | tLimMlmAssocCnf assoc_cnf; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1623 | uint32_t bytes = 0, payload, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1624 | uint8_t qos_enabled, wme_enabled, wsm_enabled; |
| 1625 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1626 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1627 | uint16_t add_ie_len; |
| 1628 | uint8_t *add_ie; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 1629 | const uint8_t *wps_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1630 | uint8_t power_caps = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1631 | uint8_t tx_flag = 0; |
| 1632 | uint8_t sme_sessionid = 0; |
| 1633 | bool vht_enabled = false; |
| 1634 | tDot11fIEExtCap extr_ext_cap; |
| 1635 | bool extr_ext_flag = true; |
| 1636 | tpSirMacMgmtHdr mac_hdr; |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1637 | uint32_t ie_offset = 0; |
| 1638 | uint8_t *p_ext_cap = NULL; |
| 1639 | tDot11fIEExtCap bcn_ext_cap; |
| 1640 | uint8_t *bcn_ie = NULL; |
| 1641 | uint32_t bcn_ie_len = 0; |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 1642 | uint32_t aes_block_size_len = 0; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1643 | enum rateid min_rid = RATEID_DEFAULT; |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 1644 | uint8_t *mbo_ie = NULL; |
| 1645 | uint8_t mbo_ie_len = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1646 | |
| 1647 | if (NULL == pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1648 | pe_err("pe_session is NULL"); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1649 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1650 | return; |
| 1651 | } |
| 1652 | |
| 1653 | sme_sessionid = pe_session->smeSessionId; |
| 1654 | |
| 1655 | /* check this early to avoid unncessary operation */ |
| 1656 | if (NULL == pe_session->pLimJoinReq) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1657 | pe_err("pe_session->pLimJoinReq is NULL"); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1658 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1659 | return; |
| 1660 | } |
| 1661 | add_ie_len = pe_session->pLimJoinReq->addIEAssoc.length; |
| 1662 | add_ie = pe_session->pLimJoinReq->addIEAssoc.addIEdata; |
| 1663 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1664 | frm = qdf_mem_malloc(sizeof(tDot11fAssocRequest)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1665 | if (!frm) { |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1666 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1667 | return; |
| 1668 | } |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1669 | qdf_mem_set((uint8_t *) frm, sizeof(tDot11fAssocRequest), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1670 | |
Agrawal Ashish | 0f94b57 | 2016-02-22 13:27:06 +0530 | [diff] [blame] | 1671 | if (add_ie_len && pe_session->is_ext_caps_present) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1672 | qdf_mem_set((uint8_t *) &extr_ext_cap, sizeof(tDot11fIEExtCap), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1673 | 0); |
| 1674 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 1675 | add_ie, &add_ie_len, &extr_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1676 | if (QDF_STATUS_SUCCESS != sir_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1677 | extr_ext_flag = false; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1678 | pe_debug("Unable to Stripoff ExtCap IE from Assoc Req"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1679 | } else { |
| 1680 | struct s_ext_cap *p_ext_cap = (struct s_ext_cap *) |
| 1681 | extr_ext_cap.bytes; |
| 1682 | |
| 1683 | if (p_ext_cap->interworking_service) |
| 1684 | p_ext_cap->qos_map = 1; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1685 | extr_ext_cap.num_bytes = |
| 1686 | lim_compute_ext_cap_ie_length(&extr_ext_cap); |
| 1687 | extr_ext_flag = (extr_ext_cap.num_bytes > 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1688 | } |
| 1689 | } else { |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 1690 | 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] | 1691 | extr_ext_flag = false; |
| 1692 | } |
| 1693 | |
| 1694 | caps = mlm_assoc_req->capabilityInfo; |
| 1695 | #if defined(FEATURE_WLAN_WAPI) |
| 1696 | /* |
| 1697 | * According to WAPI standard: |
| 1698 | * 7.3.1.4 Capability Information field |
| 1699 | * In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 |
| 1700 | * in transmitted Association or Reassociation management frames. |
| 1701 | * APs ignore the Privacy subfield within received Association and |
| 1702 | * Reassociation management frames. |
| 1703 | */ |
| 1704 | if (pe_session->encryptType == eSIR_ED_WPI) |
| 1705 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 1706 | #endif |
| 1707 | swap_bit_field16(caps, (uint16_t *) &frm->Capabilities); |
| 1708 | |
| 1709 | frm->ListenInterval.interval = mlm_assoc_req->listenInterval; |
| 1710 | populate_dot11f_ssid2(mac_ctx, &frm->SSID); |
| 1711 | populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1712 | &frm->SuppRates, pe_session); |
| 1713 | |
| 1714 | qos_enabled = (pe_session->limQosEnabled) && |
| 1715 | SIR_MAC_GET_QOS(pe_session->limCurrentBssCaps); |
| 1716 | |
| 1717 | wme_enabled = (pe_session->limWmeEnabled) && |
| 1718 | LIM_BSS_CAPS_GET(WME, pe_session->limCurrentBssQosCaps); |
| 1719 | |
| 1720 | /* We prefer .11e asociations: */ |
| 1721 | if (qos_enabled) |
| 1722 | wme_enabled = false; |
| 1723 | |
| 1724 | wsm_enabled = (pe_session->limWsmEnabled) && wme_enabled && |
| 1725 | LIM_BSS_CAPS_GET(WSM, pe_session->limCurrentBssQosCaps); |
| 1726 | |
| 1727 | if (pe_session->lim11hEnable && |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 1728 | pe_session->pLimJoinReq->spectrumMgtIndicator == true) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1729 | power_caps = true; |
| 1730 | |
| 1731 | populate_dot11f_power_caps(mac_ctx, &frm->PowerCaps, |
| 1732 | LIM_ASSOC, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1733 | populate_dot11f_supp_channels(mac_ctx, &frm->SuppChannels, |
| 1734 | LIM_ASSOC, pe_session); |
| 1735 | |
| 1736 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1737 | if (mac_ctx->rrm.rrmPEContext.rrmEnable && |
| 1738 | SIR_MAC_GET_RRM(pe_session->limCurrentBssCaps)) { |
| 1739 | if (power_caps == false) { |
| 1740 | power_caps = true; |
| 1741 | populate_dot11f_power_caps(mac_ctx, &frm->PowerCaps, |
| 1742 | LIM_ASSOC, pe_session); |
| 1743 | } |
| 1744 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1745 | if (qos_enabled) |
Naveen Rawat | cd11831 | 2016-11-22 10:46:21 -0800 | [diff] [blame] | 1746 | populate_dot11f_qos_caps_station(mac_ctx, pe_session, |
| 1747 | &frm->QOSCapsStation); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1748 | |
| 1749 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 1750 | POPULATE_DOT11F_RATES_OPERATIONAL, &frm->ExtSuppRates, |
| 1751 | pe_session); |
| 1752 | |
Gupta, Kapil | 54a1699 | 2016-01-13 19:34:02 +0530 | [diff] [blame] | 1753 | if (mac_ctx->rrm.rrmPEContext.rrmEnable && |
| 1754 | SIR_MAC_GET_RRM(pe_session->limCurrentBssCaps)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1755 | populate_dot11f_rrm_ie(mac_ctx, &frm->RRMEnabledCap, |
| 1756 | pe_session); |
Deepak Dhamdhere | 641bf32 | 2016-01-06 15:19:03 -0800 | [diff] [blame] | 1757 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1758 | /* |
| 1759 | * The join request *should* contain zero or one of the WPA and RSN |
| 1760 | * IEs. The payload send along with the request is a |
| 1761 | * 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 1762 | * typedef struct sSirRSNie |
| 1763 | * { |
| 1764 | * uint16_t length; |
| 1765 | * uint8_t rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 1766 | * } tSirRSNie, *tpSirRSNie; |
| 1767 | * So, we should be able to make the following two calls harmlessly, |
| 1768 | * since they do nothing if they don't find the given IE in the |
| 1769 | * bytestream with which they're provided. |
| 1770 | * The net effect of this will be to faithfully transmit whatever |
| 1771 | * security IE is in the join request. |
| 1772 | * However, if we're associating for the purpose of WPS |
| 1773 | * enrollment, and we've been configured to indicate that by |
| 1774 | * eliding the WPA or RSN IE, we just skip this: |
| 1775 | */ |
| 1776 | if (add_ie_len && add_ie) |
| 1777 | wps_ie = limGetWscIEPtr(mac_ctx, add_ie, add_ie_len); |
| 1778 | |
| 1779 | if (NULL == wps_ie) { |
| 1780 | populate_dot11f_rsn_opaque(mac_ctx, |
| 1781 | &(pe_session->pLimJoinReq->rsnIE), |
| 1782 | &frm->RSNOpaque); |
| 1783 | populate_dot11f_wpa_opaque(mac_ctx, |
| 1784 | &(pe_session->pLimJoinReq->rsnIE), |
| 1785 | &frm->WPAOpaque); |
| 1786 | #if defined(FEATURE_WLAN_WAPI) |
| 1787 | populate_dot11f_wapi_opaque(mac_ctx, |
| 1788 | &(pe_session->pLimJoinReq->rsnIE), |
| 1789 | &frm->WAPIOpaque); |
| 1790 | #endif /* defined(FEATURE_WLAN_WAPI) */ |
| 1791 | } |
| 1792 | /* include WME EDCA IE as well */ |
| 1793 | if (wme_enabled) { |
| 1794 | populate_dot11f_wmm_info_station_per_session(mac_ctx, |
| 1795 | pe_session, &frm->WMMInfoStation); |
| 1796 | |
| 1797 | if (wsm_enabled) |
| 1798 | populate_dot11f_wmm_caps(&frm->WMMCaps); |
| 1799 | } |
| 1800 | |
| 1801 | /* |
| 1802 | * Populate HT IEs, when operating in 11n and |
| 1803 | * when AP is also operating in 11n mode |
| 1804 | */ |
| 1805 | if (pe_session->htCapability && |
| 1806 | mac_ctx->lim.htCapabilityPresentInBeacon) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1807 | pe_debug("Populate HT Caps in Assoc Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1808 | populate_dot11f_ht_caps(mac_ctx, pe_session, &frm->HTCaps); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 1809 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 1810 | &frm->HTCaps, sizeof(frm->HTCaps)); |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 1811 | } else if (pe_session->he_with_wep_tkip) { |
| 1812 | pe_debug("Populate HT Caps in Assoc Request with WEP/TKIP"); |
| 1813 | populate_dot11f_ht_caps(mac_ctx, NULL, &frm->HTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1814 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1815 | 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] | 1816 | frm->HTCaps.supportedChannelWidthSet, |
| 1817 | frm->HTCaps.mimoPowerSave, |
| 1818 | frm->HTCaps.greenField, frm->HTCaps.shortGI20MHz, |
| 1819 | frm->HTCaps.shortGI40MHz, |
| 1820 | frm->HTCaps.dsssCckMode40MHz, |
| 1821 | frm->HTCaps.maxRxAMPDUFactor); |
| 1822 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1823 | if (pe_session->vhtCapability && |
| 1824 | pe_session->vhtCapabilityPresentInBeacon) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1825 | pe_debug("Populate VHT IEs in Assoc Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1826 | populate_dot11f_vht_caps(mac_ctx, pe_session, &frm->VHTCaps); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 1827 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 1828 | &frm->VHTCaps, sizeof(frm->VHTCaps)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1829 | vht_enabled = true; |
Kiran Kumar Lokere | 1d4094e | 2016-08-31 19:04:04 -0700 | [diff] [blame] | 1830 | if (pe_session->enableHtSmps && |
| 1831 | !pe_session->supported_nss_1x1) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1832 | pe_err("VHT OP mode IE in Assoc Req"); |
Kiran Kumar Lokere | 1d4094e | 2016-08-31 19:04:04 -0700 | [diff] [blame] | 1833 | populate_dot11f_operating_mode(mac_ctx, |
| 1834 | &frm->OperatingMode, pe_session); |
| 1835 | } |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 1836 | } else if (pe_session->he_with_wep_tkip) { |
| 1837 | pe_debug("Populate VHT IEs in Assoc Request with WEP/TKIP"); |
| 1838 | populate_dot11f_vht_caps(mac_ctx, NULL, &frm->VHTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1839 | } |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 1840 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1841 | if (!vht_enabled && |
| 1842 | pe_session->is_vendor_specific_vhtcaps) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1843 | pe_debug("Populate Vendor VHT IEs in Assoc Request"); |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1844 | frm->vendor_vht_ie.present = 1; |
Kiran Kumar Lokere | 8172263 | 2017-09-26 12:11:43 -0700 | [diff] [blame] | 1845 | frm->vendor_vht_ie.sub_type = |
| 1846 | pe_session->vendor_specific_vht_ie_sub_type; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1847 | frm->vendor_vht_ie.VHTCaps.present = 1; |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 1848 | if (!mac_ctx->mlme_cfg->vht_caps.vht_cap_info.vendor_vhtie && |
Abhishek Singh | 6884428 | 2018-01-25 16:48:41 +0530 | [diff] [blame] | 1849 | pe_session->vht_config.su_beam_formee) { |
| 1850 | pe_debug("Disable SU beamformee for vendor IE"); |
| 1851 | pe_session->vht_config.su_beam_formee = 0; |
| 1852 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1853 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1854 | &frm->vendor_vht_ie.VHTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1855 | vht_enabled = true; |
| 1856 | } |
Agrawal Ashish | 0f94b57 | 2016-02-22 13:27:06 +0530 | [diff] [blame] | 1857 | if (pe_session->is_ext_caps_present) |
| 1858 | populate_dot11f_ext_cap(mac_ctx, vht_enabled, |
| 1859 | &frm->ExtCap, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1860 | |
Wu Gao | 9381621 | 2018-08-31 16:49:54 +0800 | [diff] [blame] | 1861 | if (mac_ctx->mlme_cfg->sta.qcn_ie_support) |
Selvaraj, Sridhar | a521aab | 2017-03-25 16:42:34 +0530 | [diff] [blame] | 1862 | populate_dot11f_qcn_ie(&frm->QCN_IE); |
| 1863 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1864 | if (lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1865 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1866 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1867 | &frm->he_cap); |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 1868 | } else if (pe_session->he_with_wep_tkip) { |
| 1869 | pe_debug("Populate HE IEs in Assoc Request with WEP/TKIP"); |
| 1870 | populate_dot11f_he_caps(mac_ctx, NULL, &frm->he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1871 | } |
Selvaraj, Sridhar | c2fe7a3 | 2017-02-02 19:20:16 +0530 | [diff] [blame] | 1872 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1873 | if (pe_session->pLimJoinReq->is11Rconnection) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1874 | tSirBssDescription *bssdescr; |
| 1875 | |
| 1876 | bssdescr = &pe_session->pLimJoinReq->bssDescription; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1877 | pe_debug("mdie = %02x %02x %02x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1878 | (unsigned int) bssdescr->mdie[0], |
| 1879 | (unsigned int) bssdescr->mdie[1], |
| 1880 | (unsigned int) bssdescr->mdie[2]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1881 | populate_mdie(mac_ctx, &frm->MobilityDomain, |
| 1882 | pe_session->pLimJoinReq->bssDescription.mdie); |
| 1883 | } else { |
| 1884 | /* No 11r IEs dont send any MDIE */ |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1885 | pe_debug("MDIE not present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1886 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1887 | |
| 1888 | #ifdef FEATURE_WLAN_ESE |
| 1889 | /* |
| 1890 | * ESE Version IE will be included in association request |
| 1891 | * when ESE is enabled on DUT through ini and it is also |
| 1892 | * advertised by the peer AP to which we are trying to |
| 1893 | * associate to. |
| 1894 | */ |
| 1895 | if (pe_session->is_ese_version_ie_present && |
| 1896 | mac_ctx->roam.configParam.isEseIniFeatureEnabled) |
| 1897 | populate_dot11f_ese_version(&frm->ESEVersion); |
| 1898 | /* For ESE Associations fill the ESE IEs */ |
| 1899 | if (pe_session->isESEconnection && |
| 1900 | pe_session->pLimJoinReq->isESEFeatureIniEnabled) { |
| 1901 | #ifndef FEATURE_DISABLE_RM |
| 1902 | populate_dot11f_ese_rad_mgmt_cap(&frm->ESERadMgmtCap); |
| 1903 | #endif |
| 1904 | } |
| 1905 | #endif |
| 1906 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1907 | /* |
| 1908 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 1909 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 1910 | * dot11f get packed payload size. |
| 1911 | */ |
| 1912 | if (extr_ext_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1913 | lim_merge_extcap_struct(&frm->ExtCap, &extr_ext_cap, true); |
| 1914 | |
| 1915 | /* Clear the bits in EXTCAP IE if AP not advertise it in beacon */ |
| 1916 | if (frm->ExtCap.present && pe_session->is_ext_caps_present) { |
| 1917 | ie_offset = DOT11F_FF_TIMESTAMP_LEN + |
| 1918 | DOT11F_FF_BEACONINTERVAL_LEN + |
| 1919 | DOT11F_FF_CAPABILITIES_LEN; |
| 1920 | |
| 1921 | qdf_mem_zero((uint8_t *)&bcn_ext_cap, sizeof(tDot11fIEExtCap)); |
| 1922 | if (pe_session->beacon && pe_session->bcnLen > ie_offset) { |
| 1923 | bcn_ie = pe_session->beacon + ie_offset; |
| 1924 | bcn_ie_len = pe_session->bcnLen - ie_offset; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 1925 | p_ext_cap = (uint8_t *)wlan_get_ie_ptr_from_eid( |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1926 | DOT11F_EID_EXTCAP, |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 1927 | bcn_ie, bcn_ie_len); |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1928 | lim_update_extcap_struct(mac_ctx, p_ext_cap, |
| 1929 | &bcn_ext_cap); |
| 1930 | lim_merge_extcap_struct(&frm->ExtCap, &bcn_ext_cap, |
| 1931 | false); |
| 1932 | } |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 1933 | /* |
| 1934 | * TWT extended capabilities should be populated after the |
| 1935 | * intersection of beacon caps and self caps is done because |
| 1936 | * the bits for TWT are unique to STA and AP and cannot be |
| 1937 | * intersected. |
| 1938 | */ |
| 1939 | populate_dot11f_twt_extended_caps(mac_ctx, pe_session, |
| 1940 | &frm->ExtCap); |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1941 | } |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1942 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1943 | 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] | 1944 | add_ie, &add_ie_len, &frm->SuppOperatingClasses)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1945 | pe_debug("Unable to Stripoff supp op classes IE from Assoc Req"); |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 1946 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 1947 | if (lim_is_fils_connection(pe_session)) { |
| 1948 | populate_dot11f_fils_params(mac_ctx, frm, pe_session); |
| 1949 | aes_block_size_len = AES_BLOCK_SIZE; |
| 1950 | } |
| 1951 | |
| 1952 | /* |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 1953 | * MBO IE needs to be appendded at the end of the assoc request |
| 1954 | * frame and is not parsed and unpacked by the frame parser |
| 1955 | * as the supplicant can send multiple TLVs with same Attribute |
| 1956 | * in the MBO IE and the frame parser does not support multiple |
| 1957 | * TLVs with same attribute in a single IE. |
| 1958 | * Strip off the MBO IE from add_ie and append it at the end. |
| 1959 | */ |
| 1960 | if (wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_MBO_OUI, |
| 1961 | SIR_MAC_MBO_OUI_SIZE, add_ie, add_ie_len)) { |
| 1962 | mbo_ie = qdf_mem_malloc(DOT11F_IE_MBO_IE_MAX_LEN + 2); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1963 | if (!mbo_ie) |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 1964 | goto end; |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 1965 | |
| 1966 | qdf_status = lim_strip_ie(mac_ctx, add_ie, &add_ie_len, |
| 1967 | SIR_MAC_EID_VENDOR, ONE_BYTE, |
| 1968 | SIR_MAC_MBO_OUI, |
| 1969 | SIR_MAC_MBO_OUI_SIZE, |
| 1970 | mbo_ie, DOT11F_IE_MBO_IE_MAX_LEN); |
| 1971 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 1972 | pe_err("Failed to strip MBO IE"); |
| 1973 | goto free_mbo_ie; |
| 1974 | } |
| 1975 | |
| 1976 | /* Include the EID and length fields */ |
| 1977 | mbo_ie_len = mbo_ie[1] + 2; |
| 1978 | pe_debug("Stripped MBO IE of length %d", mbo_ie_len); |
| 1979 | } |
| 1980 | |
| 1981 | /* |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 1982 | * Do unpack to populate the add_ie buffer to frm structure |
| 1983 | * before packing the frm structure. In this way, the IE ordering |
| 1984 | * which the latest 802.11 spec mandates is maintained. |
| 1985 | */ |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 1986 | if (add_ie_len) { |
| 1987 | ret = dot11f_unpack_assoc_request(mac_ctx, add_ie, |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 1988 | add_ie_len, frm, true); |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 1989 | if (DOT11F_FAILED(ret)) { |
| 1990 | pe_err("unpack failed, ret: 0x%x", ret); |
| 1991 | goto end; |
| 1992 | } |
| 1993 | } |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 1994 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1995 | status = dot11f_get_packed_assoc_request_size(mac_ctx, frm, &payload); |
| 1996 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1997 | pe_err("Association Request packet size failure(0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1998 | status); |
| 1999 | /* We'll fall back on the worst case scenario: */ |
| 2000 | payload = sizeof(tDot11fAssocRequest); |
| 2001 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2002 | pe_warn("Association request packet size warning (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2003 | status); |
| 2004 | } |
| 2005 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2006 | bytes = payload + sizeof(tSirMacMgmtHdr) + |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2007 | aes_block_size_len + mbo_ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2008 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2009 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2010 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2011 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2012 | pe_err("Failed to allocate %d bytes", bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2013 | |
| 2014 | pe_session->limMlmState = pe_session->limPrevMlmState; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2015 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_MLM_STATE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2016 | pe_session->peSessionId, |
| 2017 | pe_session->limMlmState)); |
| 2018 | |
| 2019 | /* Update PE session id */ |
| 2020 | assoc_cnf.sessionId = pe_session->peSessionId; |
| 2021 | |
| 2022 | assoc_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2023 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2024 | lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_CNF, |
| 2025 | (uint32_t *) &assoc_cnf); |
| 2026 | |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2027 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2028 | } |
| 2029 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2030 | qdf_mem_set(frame, bytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2031 | |
| 2032 | /* Next, we fill out the buffer descriptor: */ |
| 2033 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 2034 | SIR_MAC_MGMT_ASSOC_REQ, pe_session->bssId, |
| 2035 | pe_session->selfMacAddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2036 | /* That done, pack the Assoc Request: */ |
| 2037 | status = dot11f_pack_assoc_request(mac_ctx, frm, |
| 2038 | frame + sizeof(tSirMacMgmtHdr), payload, &payload); |
| 2039 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2040 | pe_err("Assoc request pack failure (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2041 | cds_packet_free((void *)packet); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2042 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2043 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2044 | pe_warn("Assoc request pack warning (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2045 | } |
| 2046 | |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2047 | /* Copy the MBO IE to the end of the frame */ |
| 2048 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
| 2049 | mbo_ie, mbo_ie_len); |
| 2050 | payload = payload + mbo_ie_len; |
| 2051 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2052 | if (pe_session->assocReq != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2053 | qdf_mem_free(pe_session->assocReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2054 | pe_session->assocReq = NULL; |
Naveen Rawat | 83102ef | 2015-11-03 10:42:34 -0800 | [diff] [blame] | 2055 | pe_session->assocReqLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2056 | } |
| 2057 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2058 | if (lim_is_fils_connection(pe_session)) { |
| 2059 | qdf_status = aead_encrypt_assoc_req(mac_ctx, pe_session, |
| 2060 | frame, &payload); |
| 2061 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 2062 | cds_packet_free((void *)packet); |
| 2063 | qdf_mem_free(frm); |
| 2064 | return; |
| 2065 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2066 | } |
| 2067 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2068 | pe_session->assocReq = qdf_mem_malloc(payload); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2069 | if (pe_session->assocReq) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2070 | /* |
| 2071 | * Store the Assoc request. This is sent to csr/hdd in |
| 2072 | * join cnf response. |
| 2073 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2074 | qdf_mem_copy(pe_session->assocReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2075 | frame + sizeof(tSirMacMgmtHdr), payload); |
| 2076 | pe_session->assocReqLen = payload; |
| 2077 | } |
| 2078 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 2079 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2080 | || (pe_session->pePersona == QDF_P2P_CLIENT_MODE) |
| 2081 | || (pe_session->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2082 | ) |
| 2083 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2084 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2085 | if (pe_session->pePersona == QDF_P2P_CLIENT_MODE || |
| 2086 | pe_session->pePersona == QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2087 | tx_flag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2088 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2089 | mac_hdr = (tpSirMacMgmtHdr) frame; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2090 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2091 | pe_session->peSessionId, mac_hdr->fc.subType)); |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2092 | |
| 2093 | pe_debug("Sending Association Request length %d to ", bytes); |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2094 | min_rid = lim_get_min_session_txrate(pe_session); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2095 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_START_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2096 | pe_session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2097 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2098 | pe_session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2099 | qdf_status = |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2100 | wma_tx_frameWithTxComplete(mac_ctx, packet, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2101 | (uint16_t) (sizeof(tSirMacMgmtHdr) + payload), |
| 2102 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2103 | lim_tx_complete, frame, lim_assoc_tx_complete_cnf, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2104 | tx_flag, sme_sessionid, false, 0, min_rid); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2105 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2106 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2107 | pe_session->peSessionId, qdf_status)); |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2108 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2109 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2110 | pe_err("Failed to send Association Request (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2111 | qdf_status); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2112 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2113 | pe_session, SENT_FAIL, QDF_STATUS_E_FAILURE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2114 | /* Pkt will be freed up by the callback */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2115 | } |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2116 | free_mbo_ie: |
| 2117 | if (mbo_ie) |
| 2118 | qdf_mem_free(mbo_ie); |
| 2119 | |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2120 | end: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2121 | /* Free up buffer allocated for mlm_assoc_req */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2122 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2123 | mlm_assoc_req = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2124 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2125 | return; |
| 2126 | } |
| 2127 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2128 | /** |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 2129 | * lim_addba_rsp_tx_complete_cnf() - Confirmation for add BA response OTA |
| 2130 | * @context: pointer to global mac |
| 2131 | * @buf: buffer which is nothing but entire ADD BA frame |
| 2132 | * @tx_complete : Sent status |
| 2133 | * @params; tx completion params |
| 2134 | * |
| 2135 | * Return: This returns QDF_STATUS |
| 2136 | */ |
| 2137 | static QDF_STATUS lim_addba_rsp_tx_complete_cnf(void *context, |
| 2138 | qdf_nbuf_t buf, |
| 2139 | uint32_t tx_complete, |
| 2140 | void *params) |
| 2141 | { |
| 2142 | tpAniSirGlobal mac_ctx = (tpAniSirGlobal)context; |
| 2143 | tSirMacMgmtHdr *mac_hdr; |
| 2144 | tDot11faddba_rsp rsp; |
| 2145 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 2146 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 2147 | uint8_t peer_id; |
| 2148 | void *peer; |
| 2149 | uint32_t frame_len; |
| 2150 | QDF_STATUS status; |
| 2151 | uint8_t *data; |
| 2152 | |
| 2153 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) |
| 2154 | pe_debug("Add ba response successfully sent"); |
| 2155 | else |
| 2156 | pe_debug("Fail to send add ba response"); |
| 2157 | |
| 2158 | if (!buf) { |
| 2159 | pe_err("Addba response frame buffer is NULL"); |
| 2160 | return QDF_STATUS_E_FAILURE; |
| 2161 | } |
| 2162 | |
| 2163 | data = qdf_nbuf_data(buf); |
| 2164 | |
| 2165 | if (!data) { |
| 2166 | pe_err("Addba response frame is NULL"); |
| 2167 | return QDF_STATUS_E_FAILURE; |
| 2168 | } |
| 2169 | |
| 2170 | mac_hdr = (tSirMacMgmtHdr *)data; |
| 2171 | qdf_mem_zero((void *)&rsp, sizeof(tDot11faddba_rsp)); |
| 2172 | frame_len = sizeof(rsp); |
| 2173 | status = dot11f_unpack_addba_rsp(mac_ctx, (uint8_t *)data + |
| 2174 | sizeof(*mac_hdr), frame_len, |
| 2175 | &rsp, false); |
| 2176 | |
| 2177 | if (DOT11F_FAILED(status)) { |
| 2178 | pe_err("Failed to unpack and parse (0x%08x, %d bytes)", |
| 2179 | status, frame_len); |
| 2180 | goto error; |
| 2181 | } |
| 2182 | |
| 2183 | peer = cdp_peer_get_ref_by_addr(soc, pdev, mac_hdr->da, &peer_id, |
| 2184 | PEER_DEBUG_ID_WMA_ADDBA_REQ); |
| 2185 | if (!peer) { |
| 2186 | pe_debug("no PEER found for mac_addr:%pM", mac_hdr->da); |
| 2187 | goto error; |
| 2188 | } |
| 2189 | cdp_addba_resp_tx_completion(soc, peer, rsp.addba_param_set.tid, |
| 2190 | tx_complete); |
| 2191 | cdp_peer_release_ref(soc, peer, PEER_DEBUG_ID_WMA_ADDBA_REQ); |
| 2192 | error: |
| 2193 | if (buf) |
| 2194 | qdf_nbuf_free(buf); |
| 2195 | |
| 2196 | return QDF_STATUS_SUCCESS; |
| 2197 | } |
| 2198 | |
| 2199 | /** |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2200 | * lim_auth_tx_complete_cnf()- Confirmation for auth sent over the air |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2201 | * @context: pointer to global mac |
| 2202 | * @buf: buffer |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2203 | * @tx_complete : Sent status |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2204 | * @params; tx completion params |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2205 | * |
| 2206 | * Return: This returns QDF_STATUS |
| 2207 | */ |
| 2208 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2209 | static QDF_STATUS lim_auth_tx_complete_cnf(void *context, |
| 2210 | qdf_nbuf_t buf, |
| 2211 | uint32_t tx_complete, |
| 2212 | void *params) |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2213 | { |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2214 | tpAniSirGlobal mac_ctx = (tpAniSirGlobal)context; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2215 | uint16_t auth_ack_status; |
| 2216 | uint16_t reason_code; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2217 | |
Naveen Rawat | 684e8b1 | 2017-09-20 15:54:44 -0700 | [diff] [blame] | 2218 | pe_debug("tx_complete = %d %s", tx_complete, |
Zhu Jianmin | 5d8e3fe | 2018-01-04 16:16:20 +0800 | [diff] [blame] | 2219 | (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) ? |
| 2220 | "success" : "fail"); |
| 2221 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) { |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2222 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_SUCCESS; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2223 | auth_ack_status = ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2224 | reason_code = QDF_STATUS_SUCCESS; |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2225 | /* 'Change' timer for future activations */ |
| 2226 | lim_deactivate_and_change_timer(mac_ctx, eLIM_AUTH_RETRY_TIMER); |
| 2227 | } else { |
| 2228 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2229 | auth_ack_status = NOT_ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2230 | reason_code = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2231 | } |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2232 | |
| 2233 | if (buf) |
| 2234 | qdf_nbuf_free(buf); |
| 2235 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2236 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
| 2237 | NULL, auth_ack_status, reason_code); |
| 2238 | |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2239 | return QDF_STATUS_SUCCESS; |
| 2240 | } |
| 2241 | |
| 2242 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2243 | * lim_send_auth_mgmt_frame() - Send an Authentication frame |
| 2244 | * |
| 2245 | * @mac_ctx: Pointer to Global MAC structure |
| 2246 | * @auth_frame: Pointer to Authentication frame structure |
| 2247 | * @peer_addr: MAC address of destination peer |
| 2248 | * @wep_bit: wep bit in frame control for Authentication frame3 |
| 2249 | * @session: PE session information |
| 2250 | * |
| 2251 | * This function is called by lim_process_mlm_messages(). Authentication frame |
| 2252 | * is formatted and sent when this function is called. |
| 2253 | * |
| 2254 | * Return: void |
| 2255 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2256 | void |
| 2257 | lim_send_auth_mgmt_frame(tpAniSirGlobal mac_ctx, |
| 2258 | tpSirMacAuthFrameBody auth_frame, |
| 2259 | tSirMacAddr peer_addr, |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2260 | uint8_t wep_challenge_len, |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2261 | tpPESession session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2262 | { |
| 2263 | uint8_t *frame, *body; |
| 2264 | uint32_t frame_len = 0, body_len = 0; |
| 2265 | tpSirMacMgmtHdr mac_hdr; |
| 2266 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2267 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2268 | uint8_t tx_flag = 0; |
| 2269 | uint8_t sme_sessionid = 0; |
| 2270 | uint16_t ft_ies_length = 0; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2271 | bool challenge_req = false; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2272 | enum rateid min_rid = RATEID_DEFAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2273 | |
| 2274 | if (NULL == session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2275 | pe_err("Error: psession Entry is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2276 | return; |
| 2277 | } |
| 2278 | |
| 2279 | sme_sessionid = session->smeSessionId; |
| 2280 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2281 | if (wep_challenge_len) { |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2282 | /* |
| 2283 | * Auth frame3 to be sent with encrypted framebody |
| 2284 | * |
| 2285 | * Allocate buffer for Authenticaton frame of size |
| 2286 | * equal to management frame header length plus 2 bytes |
| 2287 | * each for auth algorithm number, transaction number, |
| 2288 | * status code, 128 bytes for challenge text and |
| 2289 | * 4 bytes each for IV & ICV. |
| 2290 | */ |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2291 | pe_debug("Sending encrypted auth frame to " MAC_ADDRESS_STR, |
| 2292 | MAC_ADDR_ARRAY(peer_addr)); |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2293 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2294 | body_len = wep_challenge_len + LIM_ENCR_AUTH_INFO_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2295 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2296 | |
| 2297 | goto alloc_packet; |
| 2298 | } |
| 2299 | |
Tushnim Bhattacharyya | 332b74c | 2018-08-10 10:55:51 -0700 | [diff] [blame] | 2300 | pe_debug("Sending Auth seq# %d status %d (%d) to " |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2301 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2302 | auth_frame->authTransactionSeqNumber, |
| 2303 | auth_frame->authStatusCode, |
| 2304 | (auth_frame->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 2305 | MAC_ADDR_ARRAY(peer_addr)); |
| 2306 | |
| 2307 | switch (auth_frame->authTransactionSeqNumber) { |
| 2308 | case SIR_MAC_AUTH_FRAME_1: |
| 2309 | /* |
| 2310 | * Allocate buffer for Authenticaton frame of size |
| 2311 | * equal to management frame header length plus 2 bytes |
| 2312 | * each for auth algorithm number, transaction number |
| 2313 | * and status code. |
| 2314 | */ |
| 2315 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2316 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2317 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2318 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2319 | frame_len += lim_create_fils_auth_data(mac_ctx, |
| 2320 | auth_frame, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2321 | if (auth_frame->authAlgoNumber == eSIR_FT_AUTH) { |
| 2322 | if (NULL != session->ftPEContext.pFTPreAuthReq && |
| 2323 | 0 != session->ftPEContext.pFTPreAuthReq-> |
| 2324 | ft_ies_length) { |
| 2325 | ft_ies_length = session->ftPEContext. |
| 2326 | pFTPreAuthReq->ft_ies_length; |
| 2327 | frame_len += ft_ies_length; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2328 | pe_debug("Auth frame, FTIES length added=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2329 | ft_ies_length); |
| 2330 | } else { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2331 | pe_debug("Auth frame, Does not contain FTIES!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2332 | frame_len += (2 + SIR_MDIE_SIZE); |
| 2333 | } |
| 2334 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2335 | break; |
| 2336 | |
| 2337 | case SIR_MAC_AUTH_FRAME_2: |
| 2338 | if ((auth_frame->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 2339 | ((auth_frame->authAlgoNumber == eSIR_SHARED_KEY) && |
| 2340 | (auth_frame->authStatusCode != |
| 2341 | eSIR_MAC_SUCCESS_STATUS))) { |
| 2342 | /* |
| 2343 | * Allocate buffer for Authenticaton frame of size |
| 2344 | * equal to management frame header length plus |
| 2345 | * 2 bytes each for auth algorithm number, |
| 2346 | * transaction number and status code. |
| 2347 | */ |
| 2348 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2349 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2350 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2351 | } else { |
| 2352 | /* |
| 2353 | * Shared Key algorithm with challenge text |
| 2354 | * to be sent. |
| 2355 | * |
| 2356 | * Allocate buffer for Authenticaton frame of size |
| 2357 | * equal to management frame header length plus |
| 2358 | * 2 bytes each for auth algorithm number, |
| 2359 | * transaction number, status code and 128 bytes |
| 2360 | * for challenge text. |
| 2361 | */ |
| 2362 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2363 | challenge_req = true; |
| 2364 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN + |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2365 | SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH + |
| 2366 | SIR_MAC_CHALLENGE_ID_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2367 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2368 | } |
| 2369 | break; |
| 2370 | |
| 2371 | case SIR_MAC_AUTH_FRAME_3: |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2372 | /* |
| 2373 | * Auth frame3 to be sent without encrypted framebody |
| 2374 | * |
| 2375 | * Allocate buffer for Authenticaton frame of size equal |
| 2376 | * to management frame header length plus 2 bytes each |
| 2377 | * for auth algorithm number, transaction number and |
| 2378 | * status code. |
| 2379 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2380 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2381 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2382 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2383 | break; |
| 2384 | |
| 2385 | case SIR_MAC_AUTH_FRAME_4: |
| 2386 | /* |
| 2387 | * Allocate buffer for Authenticaton frame of size equal |
| 2388 | * to management frame header length plus 2 bytes each |
| 2389 | * for auth algorithm number, transaction number and |
| 2390 | * status code. |
| 2391 | */ |
| 2392 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2393 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2394 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2395 | |
| 2396 | break; |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2397 | default: |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2398 | pe_err("Invalid auth transaction seq num"); |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2399 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2400 | } /* switch (auth_frame->authTransactionSeqNumber) */ |
| 2401 | |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2402 | alloc_packet: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2403 | qdf_status = cds_packet_alloc((uint16_t) frame_len, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2404 | (void **)&packet); |
| 2405 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2406 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2407 | pe_err("call to bufAlloc failed for AUTH frame"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2408 | return; |
| 2409 | } |
| 2410 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2411 | qdf_mem_zero(frame, frame_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2412 | |
| 2413 | /* Prepare BD */ |
| 2414 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 2415 | SIR_MAC_MGMT_AUTH, peer_addr, session->selfMacAddr); |
| 2416 | mac_hdr = (tpSirMacMgmtHdr) frame; |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2417 | if (wep_challenge_len) |
| 2418 | mac_hdr->fc.wep = LIM_WEP_IN_FC; |
| 2419 | else |
| 2420 | mac_hdr->fc.wep = LIM_NO_WEP_IN_FC; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2421 | |
| 2422 | /* Prepare BSSId */ |
Rajeev Kumar | cf835a0 | 2016-04-15 15:01:31 -0700 | [diff] [blame] | 2423 | if (LIM_IS_AP_ROLE(session)) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2424 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2425 | (uint8_t *) session->bssId, |
| 2426 | sizeof(tSirMacAddr)); |
| 2427 | |
| 2428 | /* Prepare Authentication frame body */ |
| 2429 | body = frame + sizeof(tSirMacMgmtHdr); |
| 2430 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2431 | if (wep_challenge_len) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2432 | qdf_mem_copy(body, (uint8_t *) auth_frame, body_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2433 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2434 | pe_debug("Sending Auth seq# 3 to " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2435 | MAC_ADDR_ARRAY(mac_hdr->da)); |
| 2436 | |
| 2437 | } else { |
| 2438 | *((uint16_t *) (body)) = |
| 2439 | sir_swap_u16if_needed(auth_frame->authAlgoNumber); |
| 2440 | body += sizeof(uint16_t); |
| 2441 | body_len -= sizeof(uint16_t); |
| 2442 | |
| 2443 | *((uint16_t *) (body)) = |
| 2444 | sir_swap_u16if_needed( |
| 2445 | auth_frame->authTransactionSeqNumber); |
| 2446 | body += sizeof(uint16_t); |
| 2447 | body_len -= sizeof(uint16_t); |
| 2448 | |
| 2449 | *((uint16_t *) (body)) = |
| 2450 | sir_swap_u16if_needed(auth_frame->authStatusCode); |
| 2451 | body += sizeof(uint16_t); |
| 2452 | body_len -= sizeof(uint16_t); |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2453 | |
| 2454 | if (challenge_req) { |
| 2455 | if (body_len < SIR_MAC_AUTH_CHALLENGE_BODY_LEN) { |
Himanshu Agarwal | c422ca7 | 2017-09-19 11:07:36 +0530 | [diff] [blame] | 2456 | /* copy challenge IE id, len, challenge text */ |
| 2457 | *body = auth_frame->type; |
| 2458 | body++; |
| 2459 | body_len -= sizeof(uint8_t); |
| 2460 | *body = auth_frame->length; |
| 2461 | body++; |
| 2462 | body_len -= sizeof(uint8_t); |
| 2463 | qdf_mem_copy(body, auth_frame->challengeText, |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2464 | body_len); |
| 2465 | pe_err("Incomplete challenge info: length: %d, expected: %d", |
| 2466 | body_len, |
| 2467 | SIR_MAC_AUTH_CHALLENGE_BODY_LEN); |
| 2468 | body += body_len; |
| 2469 | body_len = 0; |
| 2470 | } else { |
| 2471 | /* copy challenge IE id, len, challenge text */ |
| 2472 | *body = auth_frame->type; |
| 2473 | body++; |
| 2474 | *body = auth_frame->length; |
| 2475 | body++; |
| 2476 | qdf_mem_copy(body, auth_frame->challengeText, |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2477 | SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH); |
| 2478 | body += SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2479 | |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2480 | body_len -= SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH + |
| 2481 | SIR_MAC_CHALLENGE_ID_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2482 | } |
| 2483 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2484 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2485 | if ((auth_frame->authAlgoNumber == eSIR_FT_AUTH) && |
| 2486 | (auth_frame->authTransactionSeqNumber == |
| 2487 | SIR_MAC_AUTH_FRAME_1) && |
| 2488 | (session->ftPEContext.pFTPreAuthReq != NULL)) { |
| 2489 | |
| 2490 | if (ft_ies_length > 0) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2491 | qdf_mem_copy(body, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2492 | session->ftPEContext. |
| 2493 | pFTPreAuthReq->ft_ies, |
| 2494 | ft_ies_length); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2495 | pe_debug("Auth1 Frame FTIE is: "); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2496 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, |
| 2497 | QDF_TRACE_LEVEL_DEBUG, |
| 2498 | (uint8_t *) body, |
| 2499 | ft_ies_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2500 | } else if (NULL != session->ftPEContext. |
| 2501 | pFTPreAuthReq->pbssDescription) { |
| 2502 | /* MDID attr is 54 */ |
| 2503 | *body = SIR_MDIE_ELEMENT_ID; |
| 2504 | body++; |
| 2505 | *body = SIR_MDIE_SIZE; |
| 2506 | body++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2507 | qdf_mem_copy(body, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2508 | &session->ftPEContext.pFTPreAuthReq-> |
| 2509 | pbssDescription->mdie[0], |
| 2510 | SIR_MDIE_SIZE); |
| 2511 | } |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2512 | } else if (auth_frame->authAlgoNumber == |
Varun Reddy Yeturu | 5faa177 | 2017-10-23 11:22:01 -0700 | [diff] [blame] | 2513 | SIR_FILS_SK_WITHOUT_PFS) { |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2514 | /* TODO MDIE */ |
| 2515 | pe_debug("appending fils Auth data"); |
| 2516 | lim_add_fils_data_to_auth_frame(session, body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2517 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2518 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2519 | pe_debug("*** Sending Auth seq# %d status %d (%d) to " |
| 2520 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2521 | auth_frame->authTransactionSeqNumber, |
| 2522 | auth_frame->authStatusCode, |
| 2523 | (auth_frame->authStatusCode == |
| 2524 | eSIR_MAC_SUCCESS_STATUS), |
| 2525 | MAC_ADDR_ARRAY(mac_hdr->da)); |
| 2526 | } |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2527 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, |
| 2528 | QDF_TRACE_LEVEL_DEBUG, |
| 2529 | frame, frame_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2530 | |
Deepthi Gowri | 1de51e3 | 2016-09-01 15:47:28 +0530 | [diff] [blame] | 2531 | if ((NULL != session->ftPEContext.pFTPreAuthReq) && |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 2532 | (BAND_5G == lim_get_rf_band( |
Deepthi Gowri | 1de51e3 | 2016-09-01 15:47:28 +0530 | [diff] [blame] | 2533 | session->ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2534 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 2535 | else if ((BAND_5G == |
Deepthi Gowri | 1de51e3 | 2016-09-01 15:47:28 +0530 | [diff] [blame] | 2536 | lim_get_rf_band(session->currentOperChannel)) |
| 2537 | || (session->pePersona == QDF_P2P_CLIENT_MODE) |
| 2538 | || (session->pePersona == QDF_P2P_GO_MODE)) |
| 2539 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2540 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2541 | if (session->pePersona == QDF_P2P_CLIENT_MODE || |
| 2542 | session->pePersona == QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2543 | tx_flag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2544 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2545 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2546 | session->peSessionId, mac_hdr->fc.subType)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2547 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2548 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_NOT_RCD; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2549 | min_rid = lim_get_min_session_txrate(session); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2550 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2551 | session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2552 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 2553 | (uint16_t)frame_len, |
| 2554 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 2555 | 7, lim_tx_complete, frame, |
| 2556 | lim_auth_tx_complete_cnf, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2557 | tx_flag, sme_sessionid, false, 0, min_rid); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2558 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 2559 | session->peSessionId, qdf_status)); |
| 2560 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 2561 | pe_err("*** Could not send Auth frame, retCode=%X ***", |
| 2562 | qdf_status); |
| 2563 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
| 2564 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2565 | session, SENT_FAIL, QDF_STATUS_E_FAILURE); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2566 | /* Pkt will be freed up by the callback */ |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2567 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2568 | return; |
| 2569 | } |
| 2570 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2571 | QDF_STATUS lim_send_deauth_cnf(tpAniSirGlobal mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2572 | { |
| 2573 | uint16_t aid; |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2574 | tpDphHashNode sta_ds; |
| 2575 | tLimMlmDeauthReq *deauth_req; |
| 2576 | tLimMlmDeauthCnf deauth_cnf; |
| 2577 | tpPESession session_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2578 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2579 | deauth_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 2580 | if (deauth_req) { |
| 2581 | if (tx_timer_running( |
| 2582 | &mac_ctx->lim.limTimers.gLimDeauthAckTimer)) |
| 2583 | lim_deactivate_and_change_timer(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2584 | eLIM_DEAUTH_ACK_TIMER); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2585 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2586 | session_entry = pe_find_session_by_session_id(mac_ctx, |
| 2587 | deauth_req->sessionId); |
| 2588 | if (session_entry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2589 | pe_err("session does not exist for given sessionId"); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2590 | deauth_cnf.resultCode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2591 | eSIR_SME_INVALID_PARAMETERS; |
| 2592 | goto end; |
| 2593 | } |
| 2594 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2595 | sta_ds = |
| 2596 | dph_lookup_hash_entry(mac_ctx, |
| 2597 | deauth_req->peer_macaddr.bytes, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 2598 | &aid, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2599 | &session_entry->dph.dphHashTable); |
| 2600 | if (sta_ds == NULL) { |
| 2601 | deauth_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2602 | goto end; |
| 2603 | } |
| 2604 | |
| 2605 | /* / Receive path cleanup with dummy packet */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2606 | lim_ft_cleanup_pre_auth_info(mac_ctx, session_entry); |
| 2607 | lim_cleanup_rx_path(mac_ctx, sta_ds, session_entry); |
| 2608 | if ((session_entry->limSystemRole == eLIM_STA_ROLE) && |
| 2609 | ( |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 2610 | #ifdef FEATURE_WLAN_ESE |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2611 | (session_entry->isESEconnection) || |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 2612 | #endif |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2613 | (session_entry->isFastRoamIniFeatureEnabled) || |
| 2614 | (session_entry->is11Rconnection))) { |
Jeff Johnson | 11bd4f3 | 2017-09-18 08:15:17 -0700 | [diff] [blame] | 2615 | pe_debug("FT Preauth (%pK,%d) Deauth rc %d src = %d", |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2616 | session_entry, |
| 2617 | session_entry->peSessionId, |
| 2618 | deauth_req->reasonCode, |
| 2619 | deauth_req->deauthTrigger); |
| 2620 | lim_ft_cleanup(mac_ctx, session_entry); |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2621 | } else { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2622 | pe_debug("No FT Preauth Session Cleanup in role %d" |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2623 | #ifdef FEATURE_WLAN_ESE |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2624 | " isESE %d" |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2625 | #endif |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2626 | " isLFR %d" |
| 2627 | " is11r %d, Deauth reason %d Trigger = %d", |
| 2628 | session_entry->limSystemRole, |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2629 | #ifdef FEATURE_WLAN_ESE |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2630 | session_entry->isESEconnection, |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2631 | #endif |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2632 | session_entry->isFastRoamIniFeatureEnabled, |
| 2633 | session_entry->is11Rconnection, |
| 2634 | deauth_req->reasonCode, |
| 2635 | deauth_req->deauthTrigger); |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2636 | } |
| 2637 | /* Free up buffer allocated for mlmDeauthReq */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2638 | qdf_mem_free(deauth_req); |
| 2639 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2640 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2641 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2642 | end: |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2643 | qdf_copy_macaddr(&deauth_cnf.peer_macaddr, |
| 2644 | &deauth_req->peer_macaddr); |
| 2645 | deauth_cnf.deauthTrigger = deauth_req->deauthTrigger; |
| 2646 | deauth_cnf.aid = deauth_req->aid; |
| 2647 | deauth_cnf.sessionId = deauth_req->sessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2648 | |
| 2649 | /* Free up buffer allocated */ |
| 2650 | /* for mlmDeauthReq */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2651 | qdf_mem_free(deauth_req); |
| 2652 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2653 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2654 | lim_post_sme_message(mac_ctx, |
| 2655 | LIM_MLM_DEAUTH_CNF, (uint32_t *) &deauth_cnf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2656 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2657 | } |
| 2658 | |
| 2659 | /** |
| 2660 | * lim_send_disassoc_cnf() - Send disassoc confirmation to SME |
| 2661 | * |
| 2662 | * @mac_ctx: Handle to MAC context |
| 2663 | * |
| 2664 | * Sends disassoc confirmation to SME. Removes disassoc request stored |
| 2665 | * in lim. |
| 2666 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2667 | * Return: QDF_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2668 | */ |
| 2669 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2670 | QDF_STATUS lim_send_disassoc_cnf(tpAniSirGlobal mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2671 | { |
| 2672 | uint16_t aid; |
| 2673 | tpDphHashNode sta_ds; |
| 2674 | tLimMlmDisassocCnf disassoc_cnf; |
| 2675 | tpPESession pe_session; |
| 2676 | tLimMlmDisassocReq *disassoc_req; |
| 2677 | |
| 2678 | disassoc_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 2679 | if (disassoc_req) { |
| 2680 | if (tx_timer_running( |
| 2681 | &mac_ctx->lim.limTimers.gLimDisassocAckTimer)) |
| 2682 | lim_deactivate_and_change_timer(mac_ctx, |
| 2683 | eLIM_DISASSOC_ACK_TIMER); |
| 2684 | |
| 2685 | pe_session = pe_find_session_by_session_id( |
| 2686 | mac_ctx, disassoc_req->sessionId); |
| 2687 | if (pe_session == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2688 | pe_err("No session for given sessionId"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2689 | disassoc_cnf.resultCode = |
| 2690 | eSIR_SME_INVALID_PARAMETERS; |
| 2691 | goto end; |
| 2692 | } |
| 2693 | |
| 2694 | sta_ds = dph_lookup_hash_entry(mac_ctx, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 2695 | disassoc_req->peer_macaddr.bytes, &aid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2696 | &pe_session->dph.dphHashTable); |
| 2697 | if (sta_ds == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2698 | pe_err("StaDs Null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2699 | disassoc_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 2700 | goto end; |
| 2701 | } |
| 2702 | /* Receive path cleanup with dummy packet */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2703 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2704 | lim_cleanup_rx_path(mac_ctx, sta_ds, pe_session)) { |
| 2705 | disassoc_cnf.resultCode = |
| 2706 | eSIR_SME_RESOURCES_UNAVAILABLE; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2707 | pe_err("cleanup_rx_path error"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2708 | goto end; |
| 2709 | } |
Deepak Dhamdhere | 57c95ff | 2016-09-30 16:44:44 -0700 | [diff] [blame] | 2710 | if (LIM_IS_STA_ROLE(pe_session) && |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2711 | (disassoc_req->reasonCode != |
| 2712 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) { |
Jeff Johnson | 11bd4f3 | 2017-09-18 08:15:17 -0700 | [diff] [blame] | 2713 | pe_debug("FT Preauth Session (%pK %d) Clean up", |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2714 | pe_session, pe_session->peSessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2715 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2716 | /* Delete FT session if there exists one */ |
| 2717 | lim_ft_cleanup_pre_auth_info(mac_ctx, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2718 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2719 | /* Free up buffer allocated for mlmDisassocReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2720 | qdf_mem_free(disassoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2721 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2722 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2723 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2724 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2725 | } |
| 2726 | end: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2727 | qdf_mem_copy((uint8_t *) &disassoc_cnf.peerMacAddr, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 2728 | (uint8_t *) disassoc_req->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2729 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2730 | disassoc_cnf.aid = disassoc_req->aid; |
| 2731 | disassoc_cnf.disassocTrigger = disassoc_req->disassocTrigger; |
| 2732 | |
| 2733 | /* Update PE session ID */ |
| 2734 | disassoc_cnf.sessionId = disassoc_req->sessionId; |
| 2735 | |
| 2736 | if (disassoc_req != NULL) { |
| 2737 | /* / Free up buffer allocated for mlmDisassocReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2738 | qdf_mem_free(disassoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2739 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 2740 | } |
| 2741 | |
| 2742 | lim_post_sme_message(mac_ctx, LIM_MLM_DISASSOC_CNF, |
| 2743 | (uint32_t *) &disassoc_cnf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2744 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2745 | } |
| 2746 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2747 | QDF_STATUS lim_disassoc_tx_complete_cnf(void *context, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2748 | uint32_t tx_success, |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2749 | void *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2750 | { |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2751 | tpAniSirGlobal max_ctx = (tpAniSirGlobal)context; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2752 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2753 | pe_debug("tx_success: %d", tx_success); |
| 2754 | |
| 2755 | return lim_send_disassoc_cnf(max_ctx); |
| 2756 | } |
| 2757 | |
| 2758 | static QDF_STATUS lim_disassoc_tx_complete_cnf_handler(void *context, |
| 2759 | qdf_nbuf_t buf, |
| 2760 | uint32_t tx_success, |
| 2761 | void *params) |
| 2762 | { |
| 2763 | tpAniSirGlobal max_ctx = (tpAniSirGlobal)context; |
| 2764 | QDF_STATUS status_code; |
| 2765 | struct scheduler_msg msg = {0}; |
| 2766 | |
| 2767 | pe_debug("tx_success: %d", tx_success); |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2768 | |
| 2769 | if (buf) |
| 2770 | qdf_nbuf_free(buf); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2771 | msg.type = (uint16_t) WMA_DISASSOC_TX_COMP; |
| 2772 | msg.bodyptr = params; |
| 2773 | msg.bodyval = tx_success; |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2774 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2775 | status_code = lim_post_msg_high_priority(max_ctx, &msg); |
| 2776 | if (status_code != QDF_STATUS_SUCCESS) |
| 2777 | pe_err("posting message: %X to LIM failed, reason: %d", |
| 2778 | msg.type, status_code); |
| 2779 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2780 | } |
| 2781 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2782 | QDF_STATUS lim_deauth_tx_complete_cnf(void *context, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2783 | uint32_t tx_success, |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2784 | void *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2785 | { |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2786 | tpAniSirGlobal mac_ctx = (tpAniSirGlobal)context; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2787 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2788 | pe_debug("tx_success: %d", tx_success); |
| 2789 | |
| 2790 | return lim_send_deauth_cnf(mac_ctx); |
| 2791 | } |
| 2792 | |
| 2793 | static QDF_STATUS lim_deauth_tx_complete_cnf_handler(void *context, |
| 2794 | qdf_nbuf_t buf, |
| 2795 | uint32_t tx_success, |
| 2796 | void *params) |
| 2797 | { |
| 2798 | tpAniSirGlobal mac_ctx = (tpAniSirGlobal)context; |
| 2799 | QDF_STATUS status_code; |
| 2800 | struct scheduler_msg msg = {0}; |
| 2801 | |
| 2802 | pe_debug("tx_success: %d", tx_success); |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2803 | |
| 2804 | if (buf) |
| 2805 | qdf_nbuf_free(buf); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2806 | msg.type = (uint16_t) WMA_DEAUTH_TX_COMP; |
| 2807 | msg.bodyptr = params; |
| 2808 | msg.bodyval = tx_success; |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2809 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2810 | status_code = lim_post_msg_high_priority(mac_ctx, &msg); |
| 2811 | if (status_code != QDF_STATUS_SUCCESS) |
| 2812 | pe_err("posting message: %X to LIM failed, reason: %d", |
| 2813 | msg.type, status_code); |
| 2814 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2815 | } |
| 2816 | |
| 2817 | /** |
| 2818 | * \brief This function is called to send Disassociate frame. |
| 2819 | * |
| 2820 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2821 | * \param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2822 | * |
| 2823 | * \param nReason Indicates the reason that need to be sent in |
| 2824 | * Disassociation frame |
| 2825 | * |
| 2826 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 2827 | * sent |
| 2828 | * |
| 2829 | * |
| 2830 | */ |
| 2831 | |
| 2832 | void |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2833 | lim_send_disassoc_mgmt_frame(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2834 | uint16_t nReason, |
| 2835 | tSirMacAddr peer, |
| 2836 | tpPESession psessionEntry, bool waitForAck) |
| 2837 | { |
| 2838 | tDot11fDisassociation frm; |
| 2839 | uint8_t *pFrame; |
| 2840 | tpSirMacMgmtHdr pMacHdr; |
| 2841 | uint32_t nBytes, nPayload, nStatus; |
| 2842 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2843 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2844 | uint8_t txFlag = 0; |
| 2845 | uint32_t val = 0; |
| 2846 | uint8_t smeSessionId = 0; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 2847 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2848 | if (NULL == psessionEntry) { |
| 2849 | return; |
| 2850 | } |
| 2851 | |
| 2852 | /* |
| 2853 | * In case when cac timer is running for this SAP session then |
| 2854 | * avoid sending disassoc out. It is violation of dfs specification. |
| 2855 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2856 | if (((psessionEntry->pePersona == QDF_SAP_MODE) || |
| 2857 | (psessionEntry->pePersona == QDF_P2P_GO_MODE)) && |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2858 | (true == mac->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2859 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2860 | FL |
| 2861 | ("CAC timer is running, drop disassoc from going out")); |
| 2862 | return; |
| 2863 | } |
| 2864 | smeSessionId = psessionEntry->smeSessionId; |
| 2865 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2866 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2867 | |
| 2868 | frm.Reason.code = nReason; |
| 2869 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2870 | nStatus = dot11f_get_packed_disassociation_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2871 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2872 | 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] | 2873 | nStatus); |
| 2874 | /* We'll fall back on the worst case scenario: */ |
| 2875 | nPayload = sizeof(tDot11fDisassociation); |
| 2876 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2877 | pe_warn("There were warnings while calculating the packed size for a Disassociation (0x%08x)", |
| 2878 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2879 | } |
| 2880 | |
| 2881 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 2882 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2883 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2884 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2885 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2886 | pe_err("Failed to allocate %d bytes for a Disassociation", |
| 2887 | nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2888 | return; |
| 2889 | } |
| 2890 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2891 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2892 | |
| 2893 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2894 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2895 | SIR_MAC_MGMT_DISASSOC, peer, psessionEntry->selfMacAddr); |
| 2896 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 2897 | |
| 2898 | /* Prepare the BSSID */ |
| 2899 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 2900 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2901 | lim_set_protected_bit(mac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2902 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2903 | nStatus = dot11f_pack_disassociation(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2904 | sizeof(tSirMacMgmtHdr), |
| 2905 | nPayload, &nPayload); |
| 2906 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2907 | pe_err("Failed to pack a Disassociation (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2908 | nStatus); |
| 2909 | cds_packet_free((void *)pPacket); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2910 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2911 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2912 | pe_warn("There were warnings while packing a Disassociation (0x%08x)", |
| 2913 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2914 | } |
| 2915 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2916 | pe_debug("***Sessionid %d Sending Disassociation frame with " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2917 | "reason %u and waitForAck %d to " MAC_ADDRESS_STR " ,From " |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2918 | MAC_ADDRESS_STR, psessionEntry->peSessionId, nReason, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2919 | waitForAck, MAC_ADDR_ARRAY(pMacHdr->da), |
| 2920 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 2921 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 2922 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2923 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 2924 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2925 | ) { |
| 2926 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2927 | } |
| 2928 | |
Sushant Kaushik | 4655606 | 2015-12-02 16:57:47 +0530 | [diff] [blame] | 2929 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2930 | |
| 2931 | if (waitForAck) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2932 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2933 | psessionEntry->peSessionId, |
| 2934 | pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2935 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2936 | psessionEntry, QDF_STATUS_SUCCESS, |
| 2937 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2938 | /* Queue Disassociation frame in high priority WQ */ |
| 2939 | /* get the duration from the request */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2940 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2941 | wma_tx_frameWithTxComplete(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2942 | TXRX_FRM_802_11_MGMT, |
| 2943 | ANI_TXDIR_TODS, 7, lim_tx_complete, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2944 | pFrame, lim_disassoc_tx_complete_cnf_handler, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2945 | txFlag, smeSessionId, false, 0, |
| 2946 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2947 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2948 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2949 | psessionEntry->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2950 | |
| 2951 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 2952 | |
| 2953 | if (tx_timer_change |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2954 | (&mac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2955 | != TX_SUCCESS) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2956 | pe_err("Unable to change Disassoc ack Timer val"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2957 | return; |
| 2958 | } else if (TX_SUCCESS != |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2959 | tx_timer_activate(&mac->lim.limTimers. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2960 | gLimDisassocAckTimer)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2961 | pe_err("Unable to activate Disassoc ack Timer"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2962 | lim_deactivate_and_change_timer(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2963 | eLIM_DISASSOC_ACK_TIMER); |
| 2964 | return; |
| 2965 | } |
| 2966 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2967 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2968 | psessionEntry->peSessionId, |
| 2969 | pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2970 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2971 | psessionEntry, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2972 | QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2973 | /* Queue Disassociation frame in high priority WQ */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2974 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2975 | TXRX_FRM_802_11_MGMT, |
| 2976 | ANI_TXDIR_TODS, |
| 2977 | 7, |
| 2978 | lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2979 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2980 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2981 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2982 | psessionEntry->peSessionId, qdf_status)); |
| 2983 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2984 | pe_err("Failed to send Disassociation (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2985 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2986 | /* Pkt will be freed up by the callback */ |
| 2987 | } |
| 2988 | } |
| 2989 | } /* End lim_send_disassoc_mgmt_frame. */ |
| 2990 | |
| 2991 | /** |
| 2992 | * \brief This function is called to send a Deauthenticate frame |
| 2993 | * |
| 2994 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 2995 | * \param mac Pointer to global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2996 | * |
| 2997 | * \param nReason Indicates the reason that need to be sent in the |
| 2998 | * Deauthenticate frame |
| 2999 | * |
| 3000 | * \param peeer address of the STA to which the frame is to be sent |
| 3001 | * |
| 3002 | * |
| 3003 | */ |
| 3004 | |
| 3005 | void |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3006 | lim_send_deauth_mgmt_frame(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3007 | uint16_t nReason, |
| 3008 | tSirMacAddr peer, |
| 3009 | tpPESession psessionEntry, bool waitForAck) |
| 3010 | { |
| 3011 | tDot11fDeAuth frm; |
| 3012 | uint8_t *pFrame; |
| 3013 | tpSirMacMgmtHdr pMacHdr; |
| 3014 | uint32_t nBytes, nPayload, nStatus; |
| 3015 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3016 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3017 | uint8_t txFlag = 0; |
| 3018 | uint32_t val = 0; |
| 3019 | #ifdef FEATURE_WLAN_TDLS |
| 3020 | uint16_t aid; |
| 3021 | tpDphHashNode pStaDs; |
| 3022 | #endif |
| 3023 | uint8_t smeSessionId = 0; |
| 3024 | |
| 3025 | if (NULL == psessionEntry) { |
| 3026 | return; |
| 3027 | } |
| 3028 | |
| 3029 | /* |
| 3030 | * In case when cac timer is running for this SAP session then |
| 3031 | * avoid deauth frame out. It is violation of dfs specification. |
| 3032 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3033 | if (((psessionEntry->pePersona == QDF_SAP_MODE) || |
| 3034 | (psessionEntry->pePersona == QDF_P2P_GO_MODE)) && |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3035 | (true == mac->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3036 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3037 | FL |
| 3038 | ("CAC timer is running, drop the deauth from going out")); |
| 3039 | return; |
| 3040 | } |
| 3041 | smeSessionId = psessionEntry->smeSessionId; |
| 3042 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3043 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3044 | |
| 3045 | frm.Reason.code = nReason; |
| 3046 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3047 | nStatus = dot11f_get_packed_de_auth_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3048 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3049 | 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] | 3050 | nStatus); |
| 3051 | /* We'll fall back on the worst case scenario: */ |
| 3052 | nPayload = sizeof(tDot11fDeAuth); |
| 3053 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3054 | pe_warn("There were warnings while calculating the packed size for a De-Authentication (0x%08x)", |
| 3055 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3056 | } |
| 3057 | |
| 3058 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3059 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3060 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3061 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3062 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3063 | pe_err("Failed to allocate %d bytes for a De-Authentication", |
| 3064 | nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3065 | return; |
| 3066 | } |
| 3067 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3068 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3069 | |
| 3070 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3071 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3072 | SIR_MAC_MGMT_DEAUTH, peer, psessionEntry->selfMacAddr); |
| 3073 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3074 | |
| 3075 | /* Prepare the BSSID */ |
| 3076 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 3077 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3078 | lim_set_protected_bit(mac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3079 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3080 | nStatus = dot11f_pack_de_auth(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3081 | sizeof(tSirMacMgmtHdr), nPayload, &nPayload); |
| 3082 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3083 | pe_err("Failed to pack a DeAuthentication (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3084 | nStatus); |
| 3085 | cds_packet_free((void *)pPacket); |
| 3086 | return; |
| 3087 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3088 | pe_warn("There were warnings while packing a De-Authentication (0x%08x)", |
| 3089 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3090 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3091 | pe_debug("***Sessionid %d Sending Deauth frame with " |
| 3092 | "reason %u and waitForAck %d to " MAC_ADDRESS_STR |
| 3093 | " ,From " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3094 | psessionEntry->peSessionId, nReason, waitForAck, |
| 3095 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 3096 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 3097 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 3098 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3099 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 3100 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3101 | ) { |
| 3102 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3103 | } |
| 3104 | |
Sushant Kaushik | 4655606 | 2015-12-02 16:57:47 +0530 | [diff] [blame] | 3105 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3106 | #ifdef FEATURE_WLAN_TDLS |
| 3107 | pStaDs = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3108 | dph_lookup_hash_entry(mac, peer, &aid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3109 | &psessionEntry->dph.dphHashTable); |
| 3110 | #endif |
| 3111 | |
| 3112 | if (waitForAck) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3113 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3114 | psessionEntry->peSessionId, |
| 3115 | pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3116 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 3117 | psessionEntry, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3118 | QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3119 | /* Queue Disassociation frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3120 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3121 | wma_tx_frameWithTxComplete(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3122 | TXRX_FRM_802_11_MGMT, |
| 3123 | ANI_TXDIR_TODS, 7, lim_tx_complete, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3124 | pFrame, lim_deauth_tx_complete_cnf_handler, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3125 | txFlag, smeSessionId, false, 0, |
| 3126 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3127 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3128 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3129 | psessionEntry->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3130 | /* Pkt will be freed up by the callback lim_tx_complete */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3131 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3132 | pe_err("Failed to send De-Authentication (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3133 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3134 | |
| 3135 | /* Call lim_process_deauth_ack_timeout which will send |
| 3136 | * DeauthCnf for this frame |
| 3137 | */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3138 | lim_process_deauth_ack_timeout(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3139 | return; |
| 3140 | } |
| 3141 | |
| 3142 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 3143 | |
| 3144 | if (tx_timer_change |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3145 | (&mac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3146 | != TX_SUCCESS) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3147 | pe_err("Unable to change Deauth ack Timer val"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3148 | return; |
| 3149 | } else if (TX_SUCCESS != |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3150 | tx_timer_activate(&mac->lim.limTimers. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3151 | gLimDeauthAckTimer)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3152 | pe_err("Unable to activate Deauth ack Timer"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3153 | lim_deactivate_and_change_timer(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3154 | eLIM_DEAUTH_ACK_TIMER); |
| 3155 | return; |
| 3156 | } |
| 3157 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3158 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3159 | psessionEntry->peSessionId, |
| 3160 | pMacHdr->fc.subType)); |
| 3161 | #ifdef FEATURE_WLAN_TDLS |
| 3162 | if ((NULL != pStaDs) |
| 3163 | && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) { |
| 3164 | /* Queue Disassociation frame in high priority WQ */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3165 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 3166 | psessionEntry, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3167 | QDF_STATUS_SUCCESS, |
| 3168 | QDF_STATUS_SUCCESS); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3169 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3170 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3171 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_IBSS, |
| 3172 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3173 | smeSessionId, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3174 | } else { |
| 3175 | #endif |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3176 | lim_diag_mgmt_tx_event_report(mac, pMacHdr, |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 3177 | psessionEntry, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3178 | QDF_STATUS_SUCCESS, |
| 3179 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3180 | /* Queue Disassociation frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3181 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3182 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3183 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3184 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3185 | smeSessionId, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3186 | #ifdef FEATURE_WLAN_TDLS |
| 3187 | } |
| 3188 | #endif |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3189 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3190 | psessionEntry->peSessionId, qdf_status)); |
| 3191 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3192 | pe_err("Failed to send De-Authentication (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3193 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3194 | /* Pkt will be freed up by the callback */ |
| 3195 | } |
| 3196 | } |
| 3197 | |
| 3198 | } /* End lim_send_deauth_mgmt_frame. */ |
| 3199 | |
| 3200 | #ifdef ANI_SUPPORT_11H |
| 3201 | /** |
| 3202 | * \brief Send a Measurement Report Action frame |
| 3203 | * |
| 3204 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3205 | * \param mac Pointer to the global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3206 | * |
| 3207 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 3208 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3209 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3210 | * |
| 3211 | * |
| 3212 | */ |
| 3213 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3214 | QDF_STATUS |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3215 | lim_send_meas_report_frame(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3216 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
| 3217 | tSirMacAddr peer, tpPESession psessionEntry) |
| 3218 | { |
| 3219 | tDot11fMeasurementReport frm; |
| 3220 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3221 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3222 | tpSirMacMgmtHdr pMacHdr; |
| 3223 | uint32_t nBytes, nPayload, nStatus; |
| 3224 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3225 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3226 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3227 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3228 | |
| 3229 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 3230 | frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID; |
| 3231 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 3232 | |
| 3233 | switch (pMeasReqFrame->measReqIE.measType) { |
| 3234 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 3235 | nSirStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3236 | populate_dot11f_measurement_report0(mac, pMeasReqFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3237 | &frm.MeasurementReport); |
| 3238 | break; |
| 3239 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 3240 | nSirStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3241 | populate_dot11f_measurement_report1(mac, pMeasReqFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3242 | &frm.MeasurementReport); |
| 3243 | break; |
| 3244 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 3245 | nSirStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3246 | populate_dot11f_measurement_report2(mac, pMeasReqFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3247 | &frm.MeasurementReport); |
| 3248 | break; |
| 3249 | default: |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3250 | pe_err("Unknown measurement type %d in limSen" |
| 3251 | "dMeasReportFrame", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3252 | pMeasReqFrame->measReqIE.measType); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3253 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3254 | } |
| 3255 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3256 | if (QDF_STATUS_SUCCESS != nSirStatus) |
| 3257 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3258 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3259 | nStatus = dot11f_get_packed_measurement_report_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3260 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3261 | 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] | 3262 | nStatus); |
| 3263 | /* We'll fall back on the worst case scenario: */ |
| 3264 | nPayload = sizeof(tDot11fMeasurementReport); |
| 3265 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3266 | pe_warn("There were warnings while calculating the packed size for a Measurement Report (0x%08x)", |
| 3267 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3268 | } |
| 3269 | |
| 3270 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3271 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3272 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3273 | cds_packet_alloc(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3274 | (uint16_t) nBytes, (void **)&pFrame, |
| 3275 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3276 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3277 | pe_err("Failed to allocate %d bytes for a " |
| 3278 | "De-Authentication", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3279 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3280 | } |
| 3281 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3282 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3283 | |
| 3284 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3285 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3286 | SIR_MAC_MGMT_ACTION, peer); |
| 3287 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3288 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3289 | qdf_mem_copy(pMacHdr->bssId, psessionEntry->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3290 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3291 | lim_set_protected_bit(mac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3292 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3293 | nStatus = dot11f_pack_measurement_report(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3294 | sizeof(tSirMacMgmtHdr), |
| 3295 | nPayload, &nPayload); |
| 3296 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3297 | pe_err("Failed to pack a Measurement Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3298 | nStatus); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3299 | cds_packet_free(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3300 | (void *)pFrame, (void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3301 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3302 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3303 | pe_warn("There were warnings while packing a Measurement Report (0x%08x)", |
| 3304 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3305 | } |
| 3306 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3307 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3308 | ((psessionEntry) ? psessionEntry-> |
| 3309 | peSessionId : NO_SESSION), pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3310 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3311 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3312 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3313 | lim_tx_complete, pFrame, 0, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3314 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3315 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3316 | ((psessionEntry) ? psessionEntry->peSessionId : NO_SESSION), |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3317 | qdf_status)); |
| 3318 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3319 | pe_err("Failed to send a Measurement Report (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3320 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3321 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3322 | return QDF_STATUS_E_FAILURE; /* just allocated... */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3323 | } |
| 3324 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3325 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3326 | |
| 3327 | } /* End lim_send_meas_report_frame. */ |
| 3328 | |
| 3329 | /** |
| 3330 | * \brief Send a TPC Request Action frame |
| 3331 | * |
| 3332 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3333 | * \param mac Pointer to the global MAC datastructure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3334 | * |
| 3335 | * \param peer MAC address to which the frame should be sent |
| 3336 | * |
| 3337 | * |
| 3338 | */ |
| 3339 | |
| 3340 | void |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3341 | lim_send_tpc_request_frame(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3342 | tSirMacAddr peer, tpPESession psessionEntry) |
| 3343 | { |
| 3344 | tDot11fTPCRequest frm; |
| 3345 | uint8_t *pFrame; |
| 3346 | tpSirMacMgmtHdr pMacHdr; |
| 3347 | uint32_t nBytes, nPayload, nStatus; |
| 3348 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3349 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3350 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3351 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3352 | |
| 3353 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 3354 | frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID; |
| 3355 | frm.DialogToken.token = 1; |
| 3356 | frm.TPCRequest.present = 1; |
| 3357 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3358 | nStatus = dot11f_get_packed_tpc_request_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3359 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3360 | pe_err("Failed to calculate the packed size for a TPC Request (0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3361 | /* We'll fall back on the worst case scenario: */ |
| 3362 | nPayload = sizeof(tDot11fTPCRequest); |
| 3363 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3364 | pe_warn("There were warnings while calculating the packed size for a TPC Request (0x%08x)", |
| 3365 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3366 | } |
| 3367 | |
| 3368 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3369 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3370 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3371 | cds_packet_alloc(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3372 | (uint16_t) nBytes, (void **)&pFrame, |
| 3373 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3374 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3375 | pe_err("Failed to allocate %d bytes for a TPC" |
| 3376 | " Request", nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3377 | return; |
| 3378 | } |
| 3379 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3380 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3381 | |
| 3382 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3383 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3384 | SIR_MAC_MGMT_ACTION, peer); |
| 3385 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3386 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3387 | qdf_mem_copy(pMacHdr->bssId, psessionEntry->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3388 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3389 | lim_set_protected_bit(mac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3390 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3391 | nStatus = dot11f_pack_tpc_request(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3392 | sizeof(tSirMacMgmtHdr), |
| 3393 | nPayload, &nPayload); |
| 3394 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3395 | pe_err("Failed to pack a TPC Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3396 | nStatus); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3397 | cds_packet_free(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3398 | (void *)pFrame, (void *)pPacket); |
| 3399 | return; /* allocated! */ |
| 3400 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3401 | pe_warn("There were warnings while packing a TPC Request (0x%08x)", |
| 3402 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3403 | } |
| 3404 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3405 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3406 | ((psessionEntry) ? psessionEntry-> |
| 3407 | peSessionId : NO_SESSION), pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3408 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3409 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3410 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3411 | lim_tx_complete, pFrame, 0, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3412 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3413 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3414 | ((psessionEntry) ? psessionEntry->peSessionId : NO_SESSION), |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3415 | qdf_status)); |
| 3416 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3417 | pe_err("Failed to send a TPC Request (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3418 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3419 | /* Pkt will be freed up by the callback */ |
| 3420 | } |
| 3421 | |
| 3422 | } /* End lim_send_tpc_request_frame. */ |
| 3423 | |
| 3424 | /** |
| 3425 | * \brief Send a TPC Report Action frame |
| 3426 | * |
| 3427 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3428 | * \param mac Pointer to the global MAC datastructure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3429 | * |
| 3430 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 3431 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3432 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3433 | * |
| 3434 | * |
| 3435 | */ |
| 3436 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3437 | QDF_STATUS |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3438 | lim_send_tpc_report_frame(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3439 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
| 3440 | tSirMacAddr peer, tpPESession psessionEntry) |
| 3441 | { |
| 3442 | tDot11fTPCReport frm; |
| 3443 | uint8_t *pFrame; |
| 3444 | tpSirMacMgmtHdr pMacHdr; |
| 3445 | uint32_t nBytes, nPayload, nStatus; |
| 3446 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3447 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3448 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3449 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3450 | |
| 3451 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 3452 | frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID; |
| 3453 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 3454 | |
| 3455 | frm.TPCReport.tx_power = 0; |
| 3456 | frm.TPCReport.link_margin = 0; |
| 3457 | frm.TPCReport.present = 1; |
| 3458 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3459 | nStatus = dot11f_get_packed_tpc_report_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3460 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3461 | 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] | 3462 | /* We'll fall back on the worst case scenario: */ |
| 3463 | nPayload = sizeof(tDot11fTPCReport); |
| 3464 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3465 | pe_warn("There were warnings while calculating the packed size for a TPC Report (0x%08x)", |
| 3466 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3467 | } |
| 3468 | |
| 3469 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3470 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3471 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3472 | cds_packet_alloc(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3473 | (uint16_t) nBytes, (void **)&pFrame, |
| 3474 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3475 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3476 | pe_err("Failed to allocate %d bytes for a TPC" |
| 3477 | " Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3478 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3479 | } |
| 3480 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3481 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3482 | |
| 3483 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3484 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3485 | SIR_MAC_MGMT_ACTION, peer); |
| 3486 | |
| 3487 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3488 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3489 | qdf_mem_copy(pMacHdr->bssId, psessionEntry->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3490 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3491 | lim_set_protected_bit(mac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3492 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3493 | nStatus = dot11f_pack_tpc_report(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3494 | sizeof(tSirMacMgmtHdr), |
| 3495 | nPayload, &nPayload); |
| 3496 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3497 | pe_err("Failed to pack a TPC Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3498 | nStatus); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3499 | cds_packet_free(mac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3500 | (void *)pFrame, (void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3501 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3502 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3503 | pe_warn("There were warnings while packing a TPC Report (0x%08x)", |
| 3504 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3505 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3506 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3507 | ((psessionEntry) ? psessionEntry-> |
| 3508 | peSessionId : NO_SESSION), pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3509 | qdf_status = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3510 | wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3511 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3512 | lim_tx_complete, pFrame, 0, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3513 | MTRACE(qdf_trace |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3514 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 3515 | ((psessionEntry) ? psessionEntry->peSessionId : NO_SESSION), |
| 3516 | qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3517 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3518 | pe_err("Failed to send a TPC Report (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3519 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3520 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3521 | return QDF_STATUS_E_FAILURE; /* just allocated... */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3522 | } |
| 3523 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3524 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3525 | |
| 3526 | } /* End lim_send_tpc_report_frame. */ |
| 3527 | #endif /* ANI_SUPPORT_11H */ |
| 3528 | |
| 3529 | /** |
| 3530 | * \brief Send a Channel Switch Announcement |
| 3531 | * |
| 3532 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3533 | * \param mac Pointer to the global MAC datastructure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3534 | * |
| 3535 | * \param peer MAC address to which this frame will be sent |
| 3536 | * |
| 3537 | * \param nMode |
| 3538 | * |
| 3539 | * \param nNewChannel |
| 3540 | * |
| 3541 | * \param nCount |
| 3542 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3543 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3544 | * |
| 3545 | * |
| 3546 | */ |
| 3547 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3548 | QDF_STATUS |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3549 | lim_send_channel_switch_mgmt_frame(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3550 | tSirMacAddr peer, |
| 3551 | uint8_t nMode, |
| 3552 | uint8_t nNewChannel, |
| 3553 | uint8_t nCount, tpPESession psessionEntry) |
| 3554 | { |
| 3555 | tDot11fChannelSwitch frm; |
| 3556 | uint8_t *pFrame; |
| 3557 | tpSirMacMgmtHdr pMacHdr; |
| 3558 | uint32_t nBytes, nPayload, nStatus; /* , nCfg; */ |
| 3559 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3560 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3561 | uint8_t txFlag = 0; |
| 3562 | |
| 3563 | uint8_t smeSessionId = 0; |
| 3564 | |
| 3565 | if (psessionEntry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3566 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3567 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3568 | } |
| 3569 | smeSessionId = psessionEntry->smeSessionId; |
| 3570 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3571 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3572 | |
| 3573 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 3574 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 3575 | frm.ChanSwitchAnn.switchMode = nMode; |
| 3576 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 3577 | frm.ChanSwitchAnn.switchCount = nCount; |
| 3578 | frm.ChanSwitchAnn.present = 1; |
| 3579 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3580 | nStatus = dot11f_get_packed_channel_switch_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3581 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3582 | 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] | 3583 | nStatus); |
| 3584 | /* We'll fall back on the worst case scenario: */ |
| 3585 | nPayload = sizeof(tDot11fChannelSwitch); |
| 3586 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3587 | pe_warn("There were warnings while calculating the packed size for a Channel Switch (0x%08x)", |
| 3588 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3589 | } |
| 3590 | |
| 3591 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3592 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3593 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3594 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 3595 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3596 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3597 | pe_err("Failed to allocate %d bytes for a TPC Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3598 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3599 | } |
| 3600 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3601 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3602 | |
| 3603 | /* Next, we fill out the buffer descriptor: */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3604 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3605 | SIR_MAC_MGMT_ACTION, peer, |
| 3606 | psessionEntry->selfMacAddr); |
| 3607 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3608 | qdf_mem_copy((uint8_t *) pMacHdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3609 | (uint8_t *) psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 3610 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3611 | lim_set_protected_bit(mac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3612 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3613 | nStatus = dot11f_pack_channel_switch(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3614 | sizeof(tSirMacMgmtHdr), |
| 3615 | nPayload, &nPayload); |
| 3616 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3617 | pe_err("Failed to pack a Channel Switch (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3618 | nStatus); |
| 3619 | cds_packet_free((void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3620 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3621 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3622 | pe_warn("There were warnings while packing a Channel Switch (0x%08x)", |
| 3623 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3624 | } |
| 3625 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 3626 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3627 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 3628 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3629 | ) { |
| 3630 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3631 | } |
| 3632 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3633 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3634 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3635 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3636 | TXRX_FRM_802_11_MGMT, |
| 3637 | ANI_TXDIR_TODS, |
| 3638 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3639 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3640 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3641 | psessionEntry->peSessionId, qdf_status)); |
| 3642 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3643 | pe_err("Failed to send a Channel Switch (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3644 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3645 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3646 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3647 | } |
| 3648 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3649 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3650 | |
| 3651 | } /* End lim_send_channel_switch_mgmt_frame. */ |
| 3652 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3653 | /** |
| 3654 | * lim_send_extended_chan_switch_action_frame()- function to send ECSA |
| 3655 | * action frame over the air . |
| 3656 | * @mac_ctx: pointer to global mac structure |
| 3657 | * @peer: Destination mac. |
| 3658 | * @mode: channel switch mode |
| 3659 | * @new_op_class: new op class |
| 3660 | * @new_channel: new channel to switch |
| 3661 | * @count: channel switch count |
| 3662 | * |
| 3663 | * This function is called to send ECSA frame. |
| 3664 | * |
| 3665 | * Return: success if frame is sent else return failure |
| 3666 | */ |
| 3667 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3668 | QDF_STATUS |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3669 | lim_send_extended_chan_switch_action_frame(tpAniSirGlobal mac_ctx, |
| 3670 | tSirMacAddr peer, uint8_t mode, uint8_t new_op_class, |
| 3671 | uint8_t new_channel, uint8_t count, tpPESession session_entry) |
| 3672 | { |
| 3673 | tDot11fext_channel_switch_action_frame frm; |
| 3674 | uint8_t *frame; |
| 3675 | tpSirMacMgmtHdr mac_hdr; |
| 3676 | uint32_t num_bytes, n_payload, status; |
| 3677 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3678 | QDF_STATUS qdf_status; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3679 | uint8_t txFlag = 0; |
| 3680 | uint8_t sme_session_id = 0; |
Vignesh Viswanathan | 93b7f70 | 2017-12-19 17:48:45 +0530 | [diff] [blame] | 3681 | uint8_t ch_spacing; |
| 3682 | tLimWiderBWChannelSwitchInfo *wide_bw_ie; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3683 | |
| 3684 | if (session_entry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3685 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3686 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3687 | } |
| 3688 | |
| 3689 | sme_session_id = session_entry->smeSessionId; |
| 3690 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3691 | qdf_mem_set(&frm, sizeof(frm), 0); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3692 | |
| 3693 | frm.Category.category = SIR_MAC_ACTION_PUBLIC_USAGE; |
| 3694 | frm.Action.action = SIR_MAC_ACTION_EXT_CHANNEL_SWITCH_ID; |
| 3695 | |
| 3696 | frm.ext_chan_switch_ann_action.switch_mode = mode; |
| 3697 | frm.ext_chan_switch_ann_action.op_class = new_op_class; |
| 3698 | frm.ext_chan_switch_ann_action.new_channel = new_channel; |
| 3699 | frm.ext_chan_switch_ann_action.switch_count = count; |
| 3700 | |
Vignesh Viswanathan | 93b7f70 | 2017-12-19 17:48:45 +0530 | [diff] [blame] | 3701 | ch_spacing = wlan_reg_dmn_get_chanwidth_from_opclass( |
| 3702 | mac_ctx->scan.countryCodeCurrent, new_channel, |
| 3703 | new_op_class); |
| 3704 | pe_debug("wrapper: ch_spacing %hu", ch_spacing); |
| 3705 | |
| 3706 | if ((ch_spacing == 80) || (ch_spacing == 160)) { |
| 3707 | wide_bw_ie = &session_entry->gLimWiderBWChannelSwitch; |
| 3708 | frm.WiderBWChanSwitchAnn.newChanWidth = |
| 3709 | wide_bw_ie->newChanWidth; |
| 3710 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = |
| 3711 | wide_bw_ie->newCenterChanFreq0; |
| 3712 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = |
| 3713 | wide_bw_ie->newCenterChanFreq1; |
| 3714 | frm.WiderBWChanSwitchAnn.present = 1; |
| 3715 | pe_debug("wrapper: width:%d f0:%d f1:%d", |
| 3716 | frm.WiderBWChanSwitchAnn.newChanWidth, |
| 3717 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0, |
| 3718 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1); |
| 3719 | } |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3720 | |
| 3721 | status = dot11f_get_packed_ext_channel_switch_action_frame_size(mac_ctx, |
| 3722 | &frm, &n_payload); |
| 3723 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3724 | pe_err("Failed to get packed size for Channel Switch 0x%08x", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3725 | status); |
| 3726 | /* We'll fall back on the worst case scenario*/ |
| 3727 | n_payload = sizeof(tDot11fext_channel_switch_action_frame); |
| 3728 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3729 | 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] | 3730 | status); |
| 3731 | } |
| 3732 | |
| 3733 | num_bytes = n_payload + sizeof(tSirMacMgmtHdr); |
| 3734 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3735 | qdf_status = cds_packet_alloc((uint16_t)num_bytes, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3736 | (void **) &frame, (void **) &packet); |
| 3737 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3738 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3739 | pe_err("Failed to allocate %d bytes for a Ext Channel Switch", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3740 | num_bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3741 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3742 | } |
| 3743 | |
| 3744 | /* Paranoia*/ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3745 | qdf_mem_set(frame, num_bytes, 0); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3746 | |
| 3747 | /* Next, we fill out the buffer descriptor */ |
| 3748 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 3749 | SIR_MAC_MGMT_ACTION, peer, session_entry->selfMacAddr); |
| 3750 | mac_hdr = (tpSirMacMgmtHdr) frame; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3751 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3752 | (uint8_t *) session_entry->bssId, |
| 3753 | sizeof(tSirMacAddr)); |
| 3754 | |
gaolez | 4b62a9e | 2018-08-16 15:57:50 +0800 | [diff] [blame] | 3755 | lim_set_protected_bit(mac_ctx, session_entry, peer, mac_hdr); |
| 3756 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3757 | status = dot11f_pack_ext_channel_switch_action_frame(mac_ctx, &frm, |
| 3758 | frame + sizeof(tSirMacMgmtHdr), n_payload, &n_payload); |
| 3759 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3760 | pe_err("Failed to pack a Channel Switch 0x%08x", status); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3761 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3762 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3763 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3764 | pe_warn("There were warnings while packing a Channel Switch 0x%08x", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3765 | status); |
| 3766 | } |
| 3767 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 3768 | if ((BAND_5G == |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3769 | lim_get_rf_band(session_entry->currentOperChannel)) || |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3770 | (session_entry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 3771 | (session_entry->pePersona == QDF_P2P_GO_MODE)) { |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3772 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3773 | } |
| 3774 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3775 | pe_debug("Send Ext channel Switch to :"MAC_ADDRESS_STR" with swcount %d, swmode %d , newchannel %d newops %d", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3776 | MAC_ADDR_ARRAY(mac_hdr->da), |
| 3777 | frm.ext_chan_switch_ann_action.switch_count, |
| 3778 | frm.ext_chan_switch_ann_action.switch_mode, |
| 3779 | frm.ext_chan_switch_ann_action.new_channel, |
| 3780 | frm.ext_chan_switch_ann_action.op_class); |
| 3781 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3782 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3783 | session_entry->peSessionId, mac_hdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3784 | qdf_status = wma_tx_frame(mac_ctx, packet, (uint16_t) num_bytes, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3785 | TXRX_FRM_802_11_MGMT, |
| 3786 | ANI_TXDIR_TODS, |
| 3787 | 7, |
| 3788 | lim_tx_complete, frame, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3789 | txFlag, sme_session_id, 0, |
| 3790 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3791 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3792 | session_entry->peSessionId, qdf_status)); |
| 3793 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3794 | pe_err("Failed to send a Ext Channel Switch %X!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3795 | qdf_status); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3796 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3797 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3798 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3799 | return QDF_STATUS_SUCCESS; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3800 | } /* End lim_send_extended_chan_switch_action_frame */ |
| 3801 | |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3802 | |
| 3803 | /** |
| 3804 | * lim_oper_chan_change_confirm_tx_complete_cnf()- Confirmation for oper_chan_change_confirm |
| 3805 | * sent over the air |
| 3806 | * |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3807 | * @context: pointer to global mac |
| 3808 | * @buf: buffer |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3809 | * @tx_complete : Sent status |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3810 | * @params: tx completion params |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3811 | * |
| 3812 | * Return: This returns QDF_STATUS |
| 3813 | */ |
| 3814 | |
| 3815 | static QDF_STATUS lim_oper_chan_change_confirm_tx_complete_cnf( |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3816 | void *context, |
| 3817 | qdf_nbuf_t buf, |
| 3818 | uint32_t tx_complete, |
| 3819 | void *params) |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3820 | { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3821 | pe_debug("tx_complete: %d", tx_complete); |
Zhu Jianmin | 83e8b12 | 2018-05-18 19:24:45 +0800 | [diff] [blame] | 3822 | if (buf) |
| 3823 | qdf_nbuf_free(buf); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3824 | return QDF_STATUS_SUCCESS; |
| 3825 | } |
| 3826 | |
| 3827 | /** |
| 3828 | * lim_p2p_oper_chan_change_confirm_action_frame()- function to send |
| 3829 | * p2p oper chan change confirm action frame |
| 3830 | * @mac_ctx: pointer to global mac structure |
| 3831 | * @peer: Destination mac. |
| 3832 | * @session_entry: session entry |
| 3833 | * |
| 3834 | * This function is called to send p2p oper chan change confirm action frame. |
| 3835 | * |
| 3836 | * Return: success if frame is sent else return failure |
| 3837 | */ |
| 3838 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3839 | QDF_STATUS |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3840 | lim_p2p_oper_chan_change_confirm_action_frame(tpAniSirGlobal mac_ctx, |
| 3841 | tSirMacAddr peer, tpPESession session_entry) |
| 3842 | { |
| 3843 | tDot11fp2p_oper_chan_change_confirm frm; |
| 3844 | uint8_t *frame; |
| 3845 | tpSirMacMgmtHdr mac_hdr; |
| 3846 | uint32_t num_bytes, n_payload, status; |
| 3847 | void *packet; |
| 3848 | QDF_STATUS qdf_status; |
| 3849 | uint8_t tx_flag = 0; |
| 3850 | uint8_t sme_session_id = 0; |
| 3851 | |
| 3852 | if (session_entry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3853 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3854 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3855 | } |
| 3856 | |
| 3857 | sme_session_id = session_entry->smeSessionId; |
| 3858 | |
| 3859 | qdf_mem_set(&frm, sizeof(frm), 0); |
| 3860 | |
| 3861 | frm.Category.category = SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY; |
| 3862 | |
| 3863 | qdf_mem_copy(frm.p2p_action_oui.oui_data, |
| 3864 | SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE); |
| 3865 | frm.p2p_action_subtype.subtype = 0x04; |
| 3866 | frm.DialogToken.token = 0x0; |
| 3867 | |
| 3868 | if (session_entry->htCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3869 | pe_debug("Populate HT Caps in Assoc Request"); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3870 | populate_dot11f_ht_caps(mac_ctx, session_entry, &frm.HTCaps); |
| 3871 | } |
| 3872 | |
| 3873 | if (session_entry->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3874 | pe_debug("Populate VHT Caps in Assoc Request"); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3875 | populate_dot11f_vht_caps(mac_ctx, session_entry, &frm.VHTCaps); |
| 3876 | populate_dot11f_operating_mode(mac_ctx, |
| 3877 | &frm.OperatingMode, session_entry); |
| 3878 | } |
| 3879 | |
| 3880 | status = dot11f_get_packed_p2p_oper_chan_change_confirmSize(mac_ctx, |
| 3881 | &frm, &n_payload); |
| 3882 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3883 | pe_err("Failed to get packed size 0x%08x", status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3884 | /* We'll fall back on the worst case scenario*/ |
| 3885 | n_payload = sizeof(tDot11fp2p_oper_chan_change_confirm); |
| 3886 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3887 | pe_warn("There were warnings while calculating the packed size (0x%08x)", |
| 3888 | status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3889 | } |
| 3890 | |
| 3891 | num_bytes = n_payload + sizeof(tSirMacMgmtHdr); |
| 3892 | |
| 3893 | qdf_status = cds_packet_alloc((uint16_t)num_bytes, |
| 3894 | (void **) &frame, (void **) &packet); |
| 3895 | |
| 3896 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3897 | pe_err("Failed to allocate %d bytes", num_bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3898 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3899 | } |
| 3900 | |
| 3901 | qdf_mem_set(frame, num_bytes, 0); |
| 3902 | |
| 3903 | /* Next, fill out the buffer descriptor */ |
| 3904 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 3905 | SIR_MAC_MGMT_ACTION, peer, session_entry->selfMacAddr); |
| 3906 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 3907 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
| 3908 | (uint8_t *) session_entry->bssId, |
| 3909 | sizeof(tSirMacAddr)); |
| 3910 | |
| 3911 | status = dot11f_pack_p2p_oper_chan_change_confirm(mac_ctx, &frm, |
| 3912 | frame + sizeof(tSirMacMgmtHdr), n_payload, &n_payload); |
| 3913 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3914 | pe_err("Failed to pack 0x%08x", status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3915 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3916 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3917 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3918 | pe_warn("There were warnings while packing 0x%08x", |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3919 | status); |
| 3920 | } |
| 3921 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 3922 | if ((BAND_5G == |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3923 | lim_get_rf_band(session_entry->currentOperChannel)) || |
| 3924 | (session_entry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 3925 | (session_entry->pePersona == QDF_P2P_GO_MODE)) { |
| 3926 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3927 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3928 | pe_debug("Send frame on channel %d to mac " |
| 3929 | MAC_ADDRESS_STR, session_entry->currentOperChannel, |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3930 | MAC_ADDR_ARRAY(peer)); |
| 3931 | |
| 3932 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
| 3933 | session_entry->peSessionId, mac_hdr->fc.subType)); |
| 3934 | |
| 3935 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 3936 | (uint16_t)num_bytes, |
| 3937 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3938 | 7, lim_tx_complete, frame, |
| 3939 | lim_oper_chan_change_confirm_tx_complete_cnf, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3940 | tx_flag, sme_session_id, false, 0, RATEID_DEFAULT); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3941 | |
| 3942 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 3943 | session_entry->peSessionId, qdf_status)); |
| 3944 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3945 | pe_err("Failed to send status %X!", qdf_status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3946 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3947 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3948 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3949 | return QDF_STATUS_SUCCESS; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3950 | } |
| 3951 | |
| 3952 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3953 | QDF_STATUS |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3954 | lim_send_vht_opmode_notification_frame(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3955 | tSirMacAddr peer, |
| 3956 | uint8_t nMode, tpPESession psessionEntry) |
| 3957 | { |
| 3958 | tDot11fOperatingMode frm; |
| 3959 | uint8_t *pFrame; |
| 3960 | tpSirMacMgmtHdr pMacHdr; |
| 3961 | uint32_t nBytes, nPayload = 0, nStatus; /* , nCfg; */ |
| 3962 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3963 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3964 | uint8_t txFlag = 0; |
| 3965 | |
| 3966 | uint8_t smeSessionId = 0; |
| 3967 | |
| 3968 | if (psessionEntry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3969 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3970 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3971 | } |
| 3972 | smeSessionId = psessionEntry->smeSessionId; |
| 3973 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3974 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3975 | |
| 3976 | frm.Category.category = SIR_MAC_ACTION_VHT; |
| 3977 | frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION; |
| 3978 | frm.OperatingMode.chanWidth = nMode; |
| 3979 | frm.OperatingMode.rxNSS = 0; |
| 3980 | frm.OperatingMode.rxNSSType = 0; |
| 3981 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 3982 | nStatus = dot11f_get_packed_operating_mode_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3983 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3984 | pe_err("Failed to calculate the packed size for a Operating Mode (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3985 | nStatus); |
| 3986 | /* We'll fall back on the worst case scenario: */ |
| 3987 | nPayload = sizeof(tDot11fOperatingMode); |
| 3988 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3989 | pe_warn("There were warnings while calculating the packed size for a Operating Mode (0x%08x)", |
| 3990 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3991 | } |
| 3992 | |
| 3993 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3994 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3995 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3996 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 3997 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3998 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3999 | pe_err("Failed to allocate %d bytes for a Operating Mode Report", |
| 4000 | nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4001 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4002 | } |
| 4003 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4004 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4005 | |
| 4006 | /* Next, we fill out the buffer descriptor: */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4007 | if (psessionEntry->pePersona == QDF_SAP_MODE) |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4008 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4009 | SIR_MAC_MGMT_ACTION, peer, |
| 4010 | psessionEntry->selfMacAddr); |
| 4011 | else |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4012 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4013 | SIR_MAC_MGMT_ACTION, psessionEntry->bssId, |
| 4014 | psessionEntry->selfMacAddr); |
| 4015 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4016 | qdf_mem_copy((uint8_t *) pMacHdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4017 | (uint8_t *) psessionEntry->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4018 | nStatus = dot11f_pack_operating_mode(mac, &frm, pFrame + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4019 | sizeof(tSirMacMgmtHdr), |
| 4020 | nPayload, &nPayload); |
| 4021 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4022 | pe_err("Failed to pack a Operating Mode (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4023 | nStatus); |
| 4024 | cds_packet_free((void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4025 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4026 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4027 | pe_warn("There were warnings while packing a Operating Mode (0x%08x)", |
| 4028 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4029 | } |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4030 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4031 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4032 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4033 | ) { |
| 4034 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4035 | } |
| 4036 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4037 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4038 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4039 | qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4040 | TXRX_FRM_802_11_MGMT, |
| 4041 | ANI_TXDIR_TODS, |
| 4042 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4043 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4044 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4045 | psessionEntry->peSessionId, qdf_status)); |
| 4046 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4047 | pe_err("Failed to send a Channel Switch (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4048 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4049 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4050 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4051 | } |
| 4052 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4053 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4054 | } |
| 4055 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4056 | /** |
| 4057 | * \brief Send a Neighbor Report Request Action frame |
| 4058 | * |
| 4059 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4060 | * \param mac Pointer to the global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4061 | * |
| 4062 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 4063 | * |
| 4064 | * \param peer mac address of peer station. |
| 4065 | * |
| 4066 | * \param psessionEntry address of session entry. |
| 4067 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4068 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4069 | * |
| 4070 | * |
| 4071 | */ |
| 4072 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4073 | QDF_STATUS |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4074 | lim_send_neighbor_report_request_frame(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4075 | tpSirMacNeighborReportReq pNeighborReq, |
| 4076 | tSirMacAddr peer, tpPESession psessionEntry) |
| 4077 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4078 | QDF_STATUS statusCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4079 | tDot11fNeighborReportRequest frm; |
| 4080 | uint8_t *pFrame; |
| 4081 | tpSirMacMgmtHdr pMacHdr; |
| 4082 | uint32_t nBytes, nPayload, nStatus; |
| 4083 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4084 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4085 | uint8_t txFlag = 0; |
| 4086 | uint8_t smeSessionId = 0; |
| 4087 | |
| 4088 | if (psessionEntry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4089 | pe_err("(psession == NULL) in Request to send Neighbor Report request action frame"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4090 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4091 | } |
| 4092 | smeSessionId = psessionEntry->smeSessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4093 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4094 | |
| 4095 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 4096 | frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ; |
| 4097 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 4098 | |
| 4099 | if (pNeighborReq->ssid_present) { |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4100 | populate_dot11f_ssid(mac, &pNeighborReq->ssid, &frm.SSID); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4101 | } |
| 4102 | |
| 4103 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4104 | dot11f_get_packed_neighbor_report_request_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4105 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4106 | 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] | 4107 | nStatus); |
| 4108 | /* We'll fall back on the worst case scenario: */ |
| 4109 | nPayload = sizeof(tDot11fNeighborReportRequest); |
| 4110 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4111 | pe_warn("There were warnings while calculating the packed size for a Neighbor Report Request(0x%08x)", |
| 4112 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4113 | } |
| 4114 | |
| 4115 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4116 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4117 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4118 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4119 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4120 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4121 | pe_err("Failed to allocate %d bytes for a Neighbor " |
| 4122 | "Report Request", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4123 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4124 | } |
| 4125 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4126 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4127 | |
| 4128 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4129 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4130 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4131 | |
| 4132 | /* Update A3 with the BSSID */ |
| 4133 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4134 | |
| 4135 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 4136 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4137 | lim_set_protected_bit(mac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4138 | |
| 4139 | /* Now, we're ready to "pack" the frames */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4140 | nStatus = dot11f_pack_neighbor_report_request(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4141 | &frm, |
| 4142 | pFrame + |
| 4143 | sizeof(tSirMacMgmtHdr), |
| 4144 | nPayload, &nPayload); |
| 4145 | |
| 4146 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4147 | pe_err("Failed to pack an Neighbor Report Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4148 | nStatus); |
| 4149 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4150 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4151 | statusCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4152 | goto returnAfterError; |
| 4153 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4154 | pe_warn("There were warnings while packing Neighbor Report Request (0x%08x)", |
| 4155 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4156 | } |
| 4157 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4158 | pe_debug("Sending a Neighbor Report Request to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4159 | lim_print_mac_addr(mac, peer, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4160 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4161 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4162 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4163 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4164 | ) { |
| 4165 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4166 | } |
| 4167 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4168 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4169 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4170 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4171 | pPacket, |
| 4172 | (uint16_t) nBytes, |
| 4173 | TXRX_FRM_802_11_MGMT, |
| 4174 | ANI_TXDIR_TODS, |
| 4175 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4176 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4177 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4178 | psessionEntry->peSessionId, qdf_status)); |
| 4179 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4180 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4181 | statusCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4182 | /* Pkt will be freed up by the callback */ |
| 4183 | return statusCode; |
| 4184 | } else |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4185 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4186 | |
| 4187 | returnAfterError: |
| 4188 | cds_packet_free((void *)pPacket); |
| 4189 | |
| 4190 | return statusCode; |
| 4191 | } /* End lim_send_neighbor_report_request_frame. */ |
| 4192 | |
| 4193 | /** |
| 4194 | * \brief Send a Link Report Action frame |
| 4195 | * |
| 4196 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4197 | * \param mac Pointer to the global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4198 | * |
| 4199 | * \param pLinkReport Address of a tSirMacLinkReport |
| 4200 | * |
| 4201 | * \param peer mac address of peer station. |
| 4202 | * |
| 4203 | * \param psessionEntry address of session entry. |
| 4204 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4205 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4206 | * |
| 4207 | * |
| 4208 | */ |
| 4209 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4210 | QDF_STATUS |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4211 | lim_send_link_report_action_frame(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4212 | tpSirMacLinkReport pLinkReport, |
| 4213 | tSirMacAddr peer, tpPESession psessionEntry) |
| 4214 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4215 | QDF_STATUS statusCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4216 | tDot11fLinkMeasurementReport frm; |
| 4217 | uint8_t *pFrame; |
| 4218 | tpSirMacMgmtHdr pMacHdr; |
| 4219 | uint32_t nBytes, nPayload, nStatus; |
| 4220 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4221 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4222 | uint8_t txFlag = 0; |
| 4223 | uint8_t smeSessionId = 0; |
| 4224 | |
| 4225 | if (psessionEntry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4226 | pe_err("(psession == NULL) in Request to send Link Report action frame"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4227 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4228 | } |
| 4229 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4230 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4231 | |
| 4232 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 4233 | frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT; |
| 4234 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 4235 | |
| 4236 | /* IEEE Std. 802.11 7.3.2.18. for the report element. */ |
| 4237 | /* Even though TPC report an IE, it is represented using fixed fields since it is positioned */ |
| 4238 | /* in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 */ |
| 4239 | /* and frame parser always expects IEs to come after all fixed fields. It is easier to handle */ |
| 4240 | /* such case this way than changing the frame parser. */ |
| 4241 | frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID; |
| 4242 | frm.TPCEleLen.TPCLen = 2; |
| 4243 | frm.TxPower.txPower = pLinkReport->txPower; |
| 4244 | frm.LinkMargin.linkMargin = 0; |
| 4245 | |
| 4246 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 4247 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 4248 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 4249 | frm.RSNI.rsni = pLinkReport->rsni; |
| 4250 | |
| 4251 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4252 | dot11f_get_packed_link_measurement_report_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4253 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4254 | 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] | 4255 | /* We'll fall back on the worst case scenario: */ |
| 4256 | nPayload = sizeof(tDot11fLinkMeasurementReport); |
| 4257 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4258 | pe_warn("There were warnings while calculating the packed size for a Link Report (0x%08x)", |
| 4259 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4260 | } |
| 4261 | |
| 4262 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4263 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4264 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4265 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4266 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4267 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4268 | pe_err("Failed to allocate %d bytes for a Link " |
| 4269 | "Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4270 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4271 | } |
| 4272 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4273 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4274 | |
| 4275 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4276 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4277 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4278 | |
| 4279 | /* Update A3 with the BSSID */ |
| 4280 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4281 | |
| 4282 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 4283 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4284 | lim_set_protected_bit(mac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4285 | |
| 4286 | /* Now, we're ready to "pack" the frames */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4287 | nStatus = dot11f_pack_link_measurement_report(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4288 | &frm, |
| 4289 | pFrame + |
| 4290 | sizeof(tSirMacMgmtHdr), |
| 4291 | nPayload, &nPayload); |
| 4292 | |
| 4293 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4294 | pe_err("Failed to pack an Link Report (0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4295 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4296 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4297 | statusCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4298 | goto returnAfterError; |
| 4299 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4300 | pe_warn("There were warnings while packing Link Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4301 | nStatus); |
| 4302 | } |
| 4303 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4304 | pe_warn("Sending a Link Report to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4305 | lim_print_mac_addr(mac, peer, LOGW); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4306 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4307 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4308 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4309 | (psessionEntry->pePersona == QDF_P2P_GO_MODE)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4310 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4311 | } |
| 4312 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4313 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4314 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4315 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4316 | pPacket, |
| 4317 | (uint16_t) nBytes, |
| 4318 | TXRX_FRM_802_11_MGMT, |
| 4319 | ANI_TXDIR_TODS, |
| 4320 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4321 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4322 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4323 | psessionEntry->peSessionId, qdf_status)); |
| 4324 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4325 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4326 | statusCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4327 | /* Pkt will be freed up by the callback */ |
| 4328 | return statusCode; |
| 4329 | } else |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4330 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4331 | |
| 4332 | returnAfterError: |
| 4333 | cds_packet_free((void *)pPacket); |
| 4334 | |
| 4335 | return statusCode; |
| 4336 | } /* End lim_send_link_report_action_frame. */ |
| 4337 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4338 | QDF_STATUS |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4339 | lim_send_radio_measure_report_action_frame(tpAniSirGlobal mac, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4340 | uint8_t dialog_token, |
| 4341 | uint8_t num_report, |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 4342 | bool is_last_frame, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4343 | tpSirMacRadioMeasureReport pRRMReport, |
| 4344 | tSirMacAddr peer, |
| 4345 | tpPESession psessionEntry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4346 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4347 | QDF_STATUS statusCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4348 | uint8_t *pFrame; |
| 4349 | tpSirMacMgmtHdr pMacHdr; |
| 4350 | uint32_t nBytes, nPayload, nStatus; |
| 4351 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4352 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4353 | uint8_t i; |
| 4354 | uint8_t txFlag = 0; |
| 4355 | uint8_t smeSessionId = 0; |
Vignesh Viswanathan | 793328d | 2018-11-02 11:32:35 +0530 | [diff] [blame] | 4356 | bool is_last_report = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4357 | |
| 4358 | tDot11fRadioMeasurementReport *frm = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4359 | qdf_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 4360 | if (!frm) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4361 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4362 | |
| 4363 | if (psessionEntry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4364 | pe_err("(psession == NULL) in Request to send Beacon Report action frame"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4365 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4366 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4367 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4368 | |
Deepak Dhamdhere | 6a02148 | 2017-04-20 17:59:58 -0700 | [diff] [blame] | 4369 | smeSessionId = psessionEntry->smeSessionId; |
| 4370 | |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 4371 | pe_debug("dialog_token %d num_report %d is_last_frame %d", |
| 4372 | dialog_token, num_report, is_last_frame); |
Padma, Santhosh Kumar | 93ec7d2 | 2016-12-26 15:58:37 +0530 | [diff] [blame] | 4373 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4374 | frm->Category.category = SIR_MAC_ACTION_RRM; |
| 4375 | frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT; |
| 4376 | frm->DialogToken.token = dialog_token; |
| 4377 | |
| 4378 | frm->num_MeasurementReport = |
| 4379 | (num_report > |
| 4380 | RADIO_REPORTS_MAX_IN_A_FRAME) ? RADIO_REPORTS_MAX_IN_A_FRAME : |
| 4381 | num_report; |
| 4382 | |
| 4383 | for (i = 0; i < frm->num_MeasurementReport; i++) { |
| 4384 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 4385 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 4386 | frm->MeasurementReport[i].late = 0; /* IEEE 802.11k section 7.3.22. (always zero in rrm) */ |
| 4387 | switch (pRRMReport[i].type) { |
| 4388 | case SIR_MAC_RRM_BEACON_TYPE: |
Vignesh Viswanathan | 793328d | 2018-11-02 11:32:35 +0530 | [diff] [blame] | 4389 | /* |
| 4390 | * Last beacon report indication needs to be set to 1 |
| 4391 | * only for the last report in the last frame |
| 4392 | */ |
| 4393 | if (is_last_frame && |
| 4394 | (i == (frm->num_MeasurementReport - 1))) |
| 4395 | is_last_report = true; |
| 4396 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4397 | populate_dot11f_beacon_report(mac, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4398 | &frm->MeasurementReport[i], |
| 4399 | &pRRMReport[i].report. |
| 4400 | beaconReport, |
Vignesh Viswanathan | 793328d | 2018-11-02 11:32:35 +0530 | [diff] [blame] | 4401 | is_last_report); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4402 | frm->MeasurementReport[i].incapable = |
| 4403 | pRRMReport[i].incapable; |
| 4404 | frm->MeasurementReport[i].refused = |
| 4405 | pRRMReport[i].refused; |
| 4406 | frm->MeasurementReport[i].present = 1; |
| 4407 | break; |
| 4408 | default: |
| 4409 | frm->MeasurementReport[i].incapable = |
| 4410 | pRRMReport[i].incapable; |
| 4411 | frm->MeasurementReport[i].refused = |
| 4412 | pRRMReport[i].refused; |
| 4413 | frm->MeasurementReport[i].present = 1; |
| 4414 | break; |
| 4415 | } |
| 4416 | } |
| 4417 | |
| 4418 | nStatus = |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4419 | dot11f_get_packed_radio_measurement_report_size(mac, frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4420 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4421 | 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] | 4422 | nStatus); |
| 4423 | /* We'll fall back on the worst case scenario: */ |
| 4424 | nPayload = sizeof(tDot11fLinkMeasurementReport); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4425 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4426 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4427 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4428 | pe_warn("There were warnings while calculating the packed size for a Radio Measure Report (0x%08x)", |
| 4429 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4430 | } |
| 4431 | |
| 4432 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4433 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4434 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4435 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4436 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4437 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4438 | pe_err("Failed to allocate %d bytes for a Radio Measure " |
| 4439 | "Report", nBytes); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4440 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4441 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4442 | } |
| 4443 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4444 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4445 | |
| 4446 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4447 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4448 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4449 | |
| 4450 | /* Update A3 with the BSSID */ |
| 4451 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4452 | |
| 4453 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 4454 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4455 | lim_set_protected_bit(mac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4456 | |
| 4457 | /* Now, we're ready to "pack" the frames */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4458 | nStatus = dot11f_pack_radio_measurement_report(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4459 | frm, |
| 4460 | pFrame + |
| 4461 | sizeof(tSirMacMgmtHdr), |
| 4462 | nPayload, &nPayload); |
| 4463 | |
| 4464 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4465 | pe_err("Failed to pack an Radio Measure Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4466 | nStatus); |
| 4467 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4468 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4469 | statusCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4470 | goto returnAfterError; |
| 4471 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4472 | pe_warn("There were warnings while packing Radio Measure Report (0x%08x)", |
| 4473 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4474 | } |
| 4475 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4476 | pe_warn("Sending a Radio Measure Report to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4477 | lim_print_mac_addr(mac, peer, LOGW); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4478 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4479 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4480 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4481 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4482 | ) { |
| 4483 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4484 | } |
| 4485 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4486 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4487 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4488 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4489 | pPacket, |
| 4490 | (uint16_t) nBytes, |
| 4491 | TXRX_FRM_802_11_MGMT, |
| 4492 | ANI_TXDIR_TODS, |
| 4493 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4494 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4495 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4496 | psessionEntry->peSessionId, qdf_status)); |
| 4497 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4498 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4499 | statusCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4500 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4501 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4502 | return statusCode; |
| 4503 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4504 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4505 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4506 | } |
| 4507 | |
| 4508 | returnAfterError: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4509 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4510 | cds_packet_free((void *)pPacket); |
| 4511 | return statusCode; |
| 4512 | } |
| 4513 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4514 | #ifdef WLAN_FEATURE_11W |
| 4515 | /** |
| 4516 | * \brief Send SA query request action frame to peer |
| 4517 | * |
| 4518 | * \sa lim_send_sa_query_request_frame |
| 4519 | * |
| 4520 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4521 | * \param mac The global tpAniSirGlobal object |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4522 | * |
| 4523 | * \param transId Transaction identifier |
| 4524 | * |
| 4525 | * \param peer The Mac address of the station to which this action frame is addressed |
| 4526 | * |
| 4527 | * \param psessionEntry The PE session entry |
| 4528 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4529 | * \return QDF_STATUS_SUCCESS if setup completes successfully |
| 4530 | * QDF_STATUS_E_FAILURE is some problem is encountered |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4531 | */ |
| 4532 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4533 | QDF_STATUS lim_send_sa_query_request_frame(tpAniSirGlobal mac, uint8_t *transId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4534 | tSirMacAddr peer, |
| 4535 | tpPESession psessionEntry) |
| 4536 | { |
| 4537 | |
| 4538 | tDot11fSaQueryReq frm; /* SA query request action frame */ |
| 4539 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4540 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4541 | tpSirMacMgmtHdr pMacHdr; |
| 4542 | uint32_t nBytes, nPayload, nStatus; |
| 4543 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4544 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4545 | uint8_t txFlag = 0; |
| 4546 | uint8_t smeSessionId = 0; |
| 4547 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4548 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4549 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 4550 | /* 11w action field is : |
| 4551 | action: 0 --> SA Query Request action frame |
| 4552 | action: 1 --> SA Query Response action frame */ |
| 4553 | frm.Action.action = SIR_MAC_SA_QUERY_REQ; |
| 4554 | /* 11w SA Query Request transId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4555 | qdf_mem_copy(&frm.TransactionId.transId[0], &transId[0], 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4556 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4557 | nStatus = dot11f_get_packed_sa_query_req_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4558 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4559 | 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] | 4560 | nStatus); |
| 4561 | /* We'll fall back on the worst case scenario: */ |
| 4562 | nPayload = sizeof(tDot11fSaQueryReq); |
| 4563 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4564 | pe_warn("There were warnings while calculating the packed size for an SA Query Request (0x%08x)", |
| 4565 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4566 | } |
| 4567 | |
| 4568 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4569 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4570 | cds_packet_alloc(nBytes, (void **)&pFrame, (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4571 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4572 | pe_err("Failed to allocate %d bytes for a SA Query Request " |
| 4573 | "action frame", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4574 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4575 | } |
| 4576 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4577 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4578 | |
| 4579 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4580 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4581 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4582 | |
| 4583 | /* Update A3 with the BSSID */ |
| 4584 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4585 | |
| 4586 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 4587 | |
| 4588 | /* Since this is a SA Query Request, set the "protect" (aka WEP) bit */ |
| 4589 | /* in the FC */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4590 | lim_set_protected_bit(mac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4591 | |
| 4592 | /* Pack 11w SA Query Request frame */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4593 | nStatus = dot11f_pack_sa_query_req(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4594 | &frm, |
| 4595 | pFrame + sizeof(tSirMacMgmtHdr), |
| 4596 | nPayload, &nPayload); |
| 4597 | |
| 4598 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4599 | pe_err("Failed to pack an SA Query Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4600 | nStatus); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4601 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4602 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4603 | goto returnAfterError; |
| 4604 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4605 | pe_warn("There were warnings while packing SA Query Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4606 | nStatus); |
| 4607 | } |
| 4608 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4609 | pe_debug("Sending an SA Query Request to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4610 | lim_print_mac_addr(mac, peer, LOGD); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4611 | pe_debug("Sending an SA Query Request from "); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4612 | lim_print_mac_addr(mac, psessionEntry->selfMacAddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4613 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4614 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4615 | #ifdef WLAN_FEATURE_P2P |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4616 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4617 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4618 | #endif |
| 4619 | ) { |
| 4620 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4621 | } |
| 4622 | smeSessionId = psessionEntry->smeSessionId; |
| 4623 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4624 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4625 | pPacket, |
| 4626 | (uint16_t) nBytes, |
| 4627 | TXRX_FRM_802_11_MGMT, |
| 4628 | ANI_TXDIR_TODS, |
| 4629 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4630 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4631 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4632 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4633 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4634 | /* Pkt will be freed up by the callback */ |
| 4635 | return nSirStatus; |
| 4636 | } else { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4637 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4638 | } |
| 4639 | |
| 4640 | returnAfterError: |
| 4641 | cds_packet_free((void *)pPacket); |
| 4642 | return nSirStatus; |
| 4643 | } /* End lim_send_sa_query_request_frame */ |
| 4644 | |
| 4645 | /** |
| 4646 | * \brief Send SA query response action frame to peer |
| 4647 | * |
| 4648 | * \sa lim_send_sa_query_response_frame |
| 4649 | * |
| 4650 | * |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4651 | * \param mac The global tpAniSirGlobal object |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4652 | * |
| 4653 | * \param transId Transaction identifier received in SA query request action frame |
| 4654 | * |
| 4655 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 4656 | * |
| 4657 | * \param psessionEntry The PE session entry |
| 4658 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4659 | * \return QDF_STATUS_SUCCESS if setup completes successfully |
| 4660 | * QDF_STATUS_E_FAILURE is some problem is encountered |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4661 | */ |
| 4662 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4663 | QDF_STATUS lim_send_sa_query_response_frame(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4664 | uint8_t *transId, tSirMacAddr peer, |
| 4665 | tpPESession psessionEntry) |
| 4666 | { |
| 4667 | |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 4668 | tDot11fSaQueryRsp frm; /* SA query response action frame */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4669 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4670 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4671 | tpSirMacMgmtHdr pMacHdr; |
| 4672 | uint32_t nBytes, nPayload, nStatus; |
| 4673 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4674 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4675 | uint8_t txFlag = 0; |
| 4676 | uint8_t smeSessionId = 0; |
| 4677 | |
| 4678 | smeSessionId = psessionEntry->smeSessionId; |
| 4679 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4680 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4681 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 4682 | /*11w action field is : |
| 4683 | action: 0 --> SA query request action frame |
| 4684 | action: 1 --> SA query response action frame */ |
| 4685 | frm.Action.action = SIR_MAC_SA_QUERY_RSP; |
| 4686 | /*11w SA query response transId is same as |
| 4687 | SA query request transId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4688 | qdf_mem_copy(&frm.TransactionId.transId[0], &transId[0], 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4689 | |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4690 | nStatus = dot11f_get_packed_sa_query_rsp_size(mac, &frm, &nPayload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4691 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4692 | 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] | 4693 | nStatus); |
| 4694 | /* We'll fall back on the worst case scenario: */ |
| 4695 | nPayload = sizeof(tDot11fSaQueryRsp); |
| 4696 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4697 | pe_warn("There were warnings while calculating the packed size for an SA Query Response (0x%08x)", |
| 4698 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4699 | } |
| 4700 | |
| 4701 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4702 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4703 | cds_packet_alloc(nBytes, (void **)&pFrame, (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4704 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4705 | pe_err("Failed to allocate %d bytes for a SA query response" |
| 4706 | " action frame", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4707 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4708 | } |
| 4709 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4710 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4711 | |
| 4712 | /* Copy necessary info to BD */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4713 | lim_populate_mac_header(mac, pFrame, SIR_MAC_MGMT_FRAME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4714 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4715 | |
| 4716 | /* Update A3 with the BSSID */ |
| 4717 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4718 | |
| 4719 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 4720 | |
| 4721 | /* Since this is a SA Query Response, set the "protect" (aka WEP) bit */ |
| 4722 | /* in the FC */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4723 | lim_set_protected_bit(mac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4724 | |
| 4725 | /* Pack 11w SA query response frame */ |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4726 | nStatus = dot11f_pack_sa_query_rsp(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4727 | &frm, |
| 4728 | pFrame + sizeof(tSirMacMgmtHdr), |
| 4729 | nPayload, &nPayload); |
| 4730 | |
| 4731 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4732 | pe_err("Failed to pack an SA Query Response (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4733 | nStatus); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4734 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4735 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4736 | goto returnAfterError; |
| 4737 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4738 | pe_warn("There were warnings while packing SA Query Response (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4739 | nStatus); |
| 4740 | } |
| 4741 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4742 | pe_debug("Sending a SA Query Response to"); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4743 | lim_print_mac_addr(mac, peer, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4744 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4745 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4746 | #ifdef WLAN_FEATURE_P2P |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4747 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4748 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4749 | #endif |
| 4750 | ) { |
| 4751 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4752 | } |
| 4753 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4754 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4755 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Jeff Johnson | 99f2504 | 2018-11-21 22:49:06 -0800 | [diff] [blame^] | 4756 | qdf_status = wma_tx_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4757 | pPacket, |
| 4758 | (uint16_t) nBytes, |
| 4759 | TXRX_FRM_802_11_MGMT, |
| 4760 | ANI_TXDIR_TODS, |
| 4761 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4762 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4763 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4764 | psessionEntry->peSessionId, qdf_status)); |
| 4765 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4766 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4767 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4768 | /* Pkt will be freed up by the callback */ |
| 4769 | return nSirStatus; |
| 4770 | } else { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4771 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4772 | } |
| 4773 | |
| 4774 | returnAfterError: |
| 4775 | cds_packet_free((void *)pPacket); |
| 4776 | return nSirStatus; |
| 4777 | } /* End lim_send_sa_query_response_frame */ |
| 4778 | #endif |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4779 | |
| 4780 | /** |
| 4781 | * lim_send_addba_response_frame(): Send ADDBA response action frame to peer |
| 4782 | * @mac_ctx: mac context |
| 4783 | * @peer_mac: Peer MAC address |
| 4784 | * @tid: TID for which addba response is being sent |
| 4785 | * @session: PE session entry |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4786 | * @addba_extn_present: ADDBA extension present flag |
Kiran Kumar Lokere | aee823a | 2018-03-22 15:27:05 -0700 | [diff] [blame] | 4787 | * @amsdu_support: amsdu in ampdu support |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4788 | * |
| 4789 | * This function is called when ADDBA request is successful. ADDBA response is |
| 4790 | * setup by calling addba_response_setup API and frame is then sent out OTA. |
| 4791 | * |
| 4792 | * Return: QDF_STATUS |
| 4793 | */ |
| 4794 | QDF_STATUS lim_send_addba_response_frame(tpAniSirGlobal mac_ctx, |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4795 | tSirMacAddr peer_mac, uint16_t tid, |
Kiran Kumar Lokere | aee823a | 2018-03-22 15:27:05 -0700 | [diff] [blame] | 4796 | tpPESession session, uint8_t addba_extn_present, |
| 4797 | uint8_t amsdu_support) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4798 | { |
| 4799 | |
| 4800 | tDot11faddba_rsp frm; |
| 4801 | uint8_t *frame_ptr; |
| 4802 | tpSirMacMgmtHdr mgmt_hdr; |
| 4803 | uint32_t num_bytes, payload_size, status; |
Sandeep Puligilla | 39cec08 | 2018-04-30 15:18:45 -0700 | [diff] [blame] | 4804 | void *pkt_ptr = NULL; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4805 | QDF_STATUS qdf_status; |
| 4806 | uint8_t tx_flag = 0; |
| 4807 | uint8_t sme_sessionid = 0; |
| 4808 | uint16_t buff_size, status_code, batimeout; |
| 4809 | uint8_t peer_id, dialog_token; |
| 4810 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 4811 | void *peer, *pdev; |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4812 | uint8_t he_frag = 0; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4813 | |
| 4814 | sme_sessionid = session->smeSessionId; |
| 4815 | |
| 4816 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 4817 | if (!pdev) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4818 | pe_err("pdev is NULL"); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4819 | return QDF_STATUS_E_FAILURE; |
| 4820 | } |
| 4821 | |
Mohit Khanna | c4c2225 | 2017-11-20 11:06:33 -0800 | [diff] [blame] | 4822 | peer = cdp_peer_get_ref_by_addr(soc, pdev, peer_mac, &peer_id, |
| 4823 | PEER_DEBUG_ID_LIM_SEND_ADDBA_RESP); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4824 | if (!peer) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4825 | pe_err("PEER [%pM] not found", peer_mac); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4826 | return QDF_STATUS_E_FAILURE; |
| 4827 | } |
| 4828 | |
| 4829 | cdp_addba_responsesetup(soc, peer, tid, &dialog_token, |
| 4830 | &status_code, &buff_size, &batimeout); |
| 4831 | |
Mohit Khanna | c4c2225 | 2017-11-20 11:06:33 -0800 | [diff] [blame] | 4832 | cdp_peer_release_ref(soc, peer, PEER_DEBUG_ID_LIM_SEND_ADDBA_RESP); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4833 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
| 4834 | frm.Category.category = SIR_MAC_ACTION_BLKACK; |
| 4835 | frm.Action.action = SIR_MAC_ADDBA_RSP; |
| 4836 | |
| 4837 | frm.DialogToken.token = dialog_token; |
| 4838 | frm.Status.status = status_code; |
Kiran Kumar Lokere | 08195ef | 2018-01-17 19:25:15 -0800 | [diff] [blame] | 4839 | if (mac_ctx->reject_addba_req) { |
| 4840 | frm.Status.status = eSIR_MAC_REQ_DECLINED_STATUS; |
| 4841 | pe_err("refused addba req"); |
| 4842 | } |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4843 | frm.addba_param_set.tid = tid; |
Kiran Kumar Lokere | 96180e1 | 2018-03-12 17:58:23 -0700 | [diff] [blame] | 4844 | frm.addba_param_set.buff_size = SIR_MAC_BA_DEFAULT_BUFF_SIZE; |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 4845 | if (mac_ctx->usr_cfg_ba_buff_size) |
| 4846 | 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] | 4847 | |
| 4848 | if (frm.addba_param_set.buff_size > MAX_BA_BUFF_SIZE) |
| 4849 | frm.addba_param_set.buff_size = MAX_BA_BUFF_SIZE; |
| 4850 | |
| 4851 | if (frm.addba_param_set.buff_size > SIR_MAC_BA_DEFAULT_BUFF_SIZE) { |
| 4852 | if (session->active_ba_64_session) { |
| 4853 | frm.addba_param_set.buff_size = |
| 4854 | SIR_MAC_BA_DEFAULT_BUFF_SIZE; |
| 4855 | } |
| 4856 | } else if (!session->active_ba_64_session) { |
| 4857 | session->active_ba_64_session = true; |
| 4858 | } |
Arif Hussain | 0e24680 | 2018-05-01 18:13:44 -0700 | [diff] [blame] | 4859 | if (mac_ctx->is_usr_cfg_amsdu_enabled) |
| 4860 | frm.addba_param_set.amsdu_supp = amsdu_support; |
| 4861 | else |
| 4862 | frm.addba_param_set.amsdu_supp = 0; |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 4863 | frm.addba_param_set.policy = SIR_MAC_BA_POLICY_IMMEDIATE; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4864 | frm.ba_timeout.timeout = batimeout; |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4865 | if (addba_extn_present) { |
| 4866 | frm.addba_extn_element.present = 1; |
| 4867 | frm.addba_extn_element.no_fragmentation = 1; |
| 4868 | if (lim_is_session_he_capable(session)) { |
| 4869 | he_frag = lim_get_session_he_frag_cap(session); |
| 4870 | if (he_frag != 0) { |
| 4871 | frm.addba_extn_element.no_fragmentation = 0; |
| 4872 | frm.addba_extn_element.he_frag_operation = |
| 4873 | he_frag; |
| 4874 | } |
| 4875 | } |
| 4876 | } |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4877 | |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4878 | pe_debug("Sending a ADDBA Response from %pM to %pM", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4879 | session->selfMacAddr, peer_mac); |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4880 | 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] | 4881 | tid, frm.DialogToken.token, frm.Status.status, |
| 4882 | frm.addba_param_set.buff_size); |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4883 | pe_debug("addba_extn %d he_capable %d no_frag %d he_frag %d", |
| 4884 | addba_extn_present, |
| 4885 | lim_is_session_he_capable(session), |
| 4886 | frm.addba_extn_element.no_fragmentation, |
| 4887 | frm.addba_extn_element.he_frag_operation); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4888 | |
| 4889 | status = dot11f_get_packed_addba_rsp_size(mac_ctx, &frm, &payload_size); |
| 4890 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4891 | 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] | 4892 | status); |
| 4893 | /* We'll fall back on the worst case scenario: */ |
| 4894 | payload_size = sizeof(tDot11faddba_rsp); |
| 4895 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4896 | 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] | 4897 | } |
| 4898 | |
| 4899 | num_bytes = payload_size + sizeof(*mgmt_hdr); |
| 4900 | qdf_status = cds_packet_alloc(num_bytes, (void **)&frame_ptr, |
| 4901 | (void **)&pkt_ptr); |
Sandeep Puligilla | 39cec08 | 2018-04-30 15:18:45 -0700 | [diff] [blame] | 4902 | if (!QDF_IS_STATUS_SUCCESS(qdf_status) || (!pkt_ptr)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4903 | pe_err("Failed to allocate %d bytes for a ADDBA response action frame", |
| 4904 | num_bytes); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4905 | return QDF_STATUS_E_FAILURE; |
| 4906 | } |
| 4907 | qdf_mem_set(frame_ptr, num_bytes, 0); |
| 4908 | |
| 4909 | lim_populate_mac_header(mac_ctx, frame_ptr, SIR_MAC_MGMT_FRAME, |
| 4910 | SIR_MAC_MGMT_ACTION, peer_mac, session->selfMacAddr); |
| 4911 | |
| 4912 | /* Update A3 with the BSSID */ |
| 4913 | mgmt_hdr = (tpSirMacMgmtHdr) frame_ptr; |
| 4914 | sir_copy_mac_addr(mgmt_hdr->bssId, session->bssId); |
| 4915 | |
| 4916 | /* ADDBA Response is a robust mgmt action frame, |
| 4917 | * set the "protect" (aka WEP) bit in the FC |
| 4918 | */ |
| 4919 | lim_set_protected_bit(mac_ctx, session, peer_mac, mgmt_hdr); |
| 4920 | |
| 4921 | status = dot11f_pack_addba_rsp(mac_ctx, &frm, |
| 4922 | frame_ptr + sizeof(tSirMacMgmtHdr), payload_size, |
| 4923 | &payload_size); |
| 4924 | |
| 4925 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4926 | pe_err("Failed to pack a ADDBA Response (0x%08x)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4927 | status); |
| 4928 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4929 | goto error_addba_rsp; |
| 4930 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4931 | pe_warn("There were warnings while packing ADDBA Response (0x%08x)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4932 | status); |
| 4933 | } |
| 4934 | |
| 4935 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4936 | if ((BAND_5G == lim_get_rf_band(session->currentOperChannel)) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4937 | #ifdef WLAN_FEATURE_P2P |
| 4938 | || (session->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4939 | (session->pePersona == QDF_P2P_GO_MODE) |
| 4940 | #endif |
| 4941 | ) { |
| 4942 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4943 | } |
| 4944 | |
| 4945 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
| 4946 | session->peSessionId, mgmt_hdr->fc.subType)); |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 4947 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, pkt_ptr, |
| 4948 | (uint16_t)num_bytes, |
| 4949 | TXRX_FRM_802_11_MGMT, |
| 4950 | ANI_TXDIR_TODS, 7, |
| 4951 | NULL, frame_ptr, |
| 4952 | lim_addba_rsp_tx_complete_cnf, |
| 4953 | tx_flag, sme_sessionid, |
| 4954 | false, 0, RATEID_DEFAULT); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4955 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 4956 | session->peSessionId, qdf_status)); |
| 4957 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4958 | pe_err("wma_tx_frame FAILED! Status [%d]", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4959 | qdf_status); |
| 4960 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4961 | /* |
| 4962 | * wma_tx_frame free memory in certain cases, free pkt_ptr |
| 4963 | * only if not freed already. |
| 4964 | */ |
| 4965 | if (pkt_ptr) |
| 4966 | cds_packet_free((void *)pkt_ptr); |
| 4967 | return qdf_status; |
| 4968 | } else { |
Tushnim Bhattacharyya | d58e4c9 | 2018-03-27 13:40:12 -0700 | [diff] [blame] | 4969 | return QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4970 | } |
| 4971 | |
| 4972 | error_addba_rsp: |
| 4973 | cds_packet_free((void *)pkt_ptr); |
| 4974 | return qdf_status; |
| 4975 | } |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 4976 | |
| 4977 | /** |
| 4978 | * lim_tx_mgmt_frame() - Transmits Auth mgmt frame |
| 4979 | * @mac_ctx Pointer to Global MAC structure |
| 4980 | * @mb_msg: Received message info |
| 4981 | * @msg_len: Received message length |
| 4982 | * @packet: Packet to be transmitted |
| 4983 | * @frame: Received frame |
| 4984 | * |
| 4985 | * Return: None |
| 4986 | */ |
| 4987 | static void lim_tx_mgmt_frame(tpAniSirGlobal mac_ctx, |
| 4988 | struct sir_mgmt_msg *mb_msg, uint32_t msg_len, |
| 4989 | void *packet, uint8_t *frame) |
| 4990 | { |
| 4991 | tpSirMacFrameCtl fc = (tpSirMacFrameCtl) mb_msg->data; |
| 4992 | QDF_STATUS qdf_status; |
| 4993 | uint8_t sme_session_id = 0; |
| 4994 | tpPESession session; |
| 4995 | uint16_t auth_ack_status; |
| 4996 | enum rateid min_rid = RATEID_DEFAULT; |
| 4997 | |
| 4998 | sme_session_id = mb_msg->session_id; |
| 4999 | session = pe_find_session_by_sme_session_id(mac_ctx, sme_session_id); |
| 5000 | if (session == NULL) { |
| 5001 | pe_err("session not found for given sme session"); |
| 5002 | return; |
| 5003 | } |
| 5004 | |
Ashish Kumar Dhanotiya | 9f72df0 | 2018-07-23 19:20:04 +0530 | [diff] [blame] | 5005 | qdf_mtrace(QDF_MODULE_ID_PE, QDF_MODULE_ID_WMA, TRACE_CODE_TX_MGMT, |
| 5006 | session->peSessionId, 0); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5007 | |
| 5008 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_NOT_RCD; |
| 5009 | min_rid = lim_get_min_session_txrate(session); |
| 5010 | |
| 5011 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 5012 | (uint16_t)msg_len, |
| 5013 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 5014 | 7, lim_tx_complete, frame, |
| 5015 | lim_auth_tx_complete_cnf, |
| 5016 | 0, sme_session_id, false, 0, min_rid); |
| 5017 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 5018 | session->peSessionId, qdf_status)); |
| 5019 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Rachit Kankane | 0baf6e7 | 2018-01-19 15:01:50 +0530 | [diff] [blame] | 5020 | pe_err("*** Could not send Auth frame (subType: %d), retCode=%X ***", |
| 5021 | fc->subType, qdf_status); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5022 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
| 5023 | auth_ack_status = SENT_FAIL; |
| 5024 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 5025 | session, auth_ack_status, QDF_STATUS_E_FAILURE); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5026 | /* Pkt will be freed up by the callback */ |
| 5027 | } |
| 5028 | } |
| 5029 | |
| 5030 | void lim_send_mgmt_frame_tx(tpAniSirGlobal mac_ctx, |
| 5031 | struct scheduler_msg *msg) |
| 5032 | { |
| 5033 | struct sir_mgmt_msg *mb_msg = (struct sir_mgmt_msg *)msg->bodyptr; |
| 5034 | uint32_t msg_len; |
| 5035 | tpSirMacFrameCtl fc = (tpSirMacFrameCtl) mb_msg->data; |
| 5036 | uint8_t sme_session_id; |
| 5037 | QDF_STATUS qdf_status; |
| 5038 | uint8_t *frame; |
| 5039 | void *packet; |
| 5040 | |
| 5041 | msg_len = mb_msg->msg_len - sizeof(*mb_msg); |
| 5042 | pe_debug("sending fc->type: %d fc->subType: %d", |
| 5043 | fc->type, fc->subType); |
| 5044 | |
| 5045 | sme_session_id = mb_msg->session_id; |
| 5046 | |
| 5047 | qdf_status = cds_packet_alloc((uint16_t) msg_len, (void **)&frame, |
| 5048 | (void **)&packet); |
| 5049 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 5050 | pe_err("call to bufAlloc failed for AUTH frame"); |
| 5051 | return; |
| 5052 | } |
| 5053 | |
| 5054 | qdf_mem_copy(frame, mb_msg->data, msg_len); |
| 5055 | |
| 5056 | lim_tx_mgmt_frame(mac_ctx, mb_msg, msg_len, packet, frame); |
| 5057 | } |