Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Yue Ma | d03d10b | 2019-12-23 15:09:53 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
| 19 | /* |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 20 | * This file lim_process_assoc_req_frame.c contains the code |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 21 | * for processing Re/Association Request Frame. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 22 | */ |
| 23 | #include "cds_api.h" |
| 24 | #include "ani_global.h" |
| 25 | #include "wni_cfg.h" |
| 26 | #include "sir_api.h" |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 27 | #include "cfg_ucfg_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 28 | |
| 29 | #include "sch_api.h" |
| 30 | #include "utils_api.h" |
| 31 | #include "lim_types.h" |
| 32 | #include "lim_utils.h" |
| 33 | #include "lim_assoc_utils.h" |
| 34 | #include "lim_security_utils.h" |
| 35 | #include "lim_ser_des_utils.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 36 | #include "lim_admit_control.h" |
| 37 | #include "cds_packet.h" |
| 38 | #include "lim_session_utils.h" |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 39 | #include "utils_parser.h" |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 40 | #include "wlan_p2p_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 41 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 42 | #include "qdf_types.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 43 | #include "cds_utils.h" |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 44 | #include "wlan_utility.h" |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 45 | #include "wlan_crypto_global_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 46 | |
| 47 | /** |
| 48 | * lim_convert_supported_channels - Parses channel support IE |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 49 | * @mac_ctx: A pointer to Global MAC structure |
| 50 | * @assoc_ind: A pointer to SME ASSOC/REASSOC IND |
| 51 | * @assoc_req: A pointer to ASSOC/REASSOC Request frame |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 52 | * |
| 53 | * This function is called by lim_process_assoc_req_frame() to |
| 54 | * parse the channel support IE in the Assoc/Reassoc Request |
| 55 | * frame, and send relevant information in the SME_ASSOC_IND |
| 56 | * |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 57 | * Return: None |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 58 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 59 | static void lim_convert_supported_channels(struct mac_context *mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 60 | tpLimMlmAssocInd assoc_ind, |
| 61 | tSirAssocReq *assoc_req) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 62 | { |
| 63 | uint16_t i, j, index = 0; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 64 | uint8_t first_ch_no; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 65 | uint8_t chn_count; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 66 | uint8_t next_ch_no; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 67 | uint8_t channel_offset = 0; |
Amruta Kulkarni | 453c4e2 | 2019-11-20 10:59:21 -0800 | [diff] [blame] | 68 | uint32_t chan_freq; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 69 | |
| 70 | if (assoc_req->supportedChannels.length >= |
| 71 | SIR_MAX_SUPPORTED_CHANNEL_LIST) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 72 | pe_err("Number of supported channels: %d is more than MAX", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 73 | assoc_req->supportedChannels.length); |
| 74 | assoc_ind->supportedChannels.numChnl = 0; |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | for (i = 0; i < (assoc_req->supportedChannels.length); i++) { |
| 79 | /* Get First Channel Number */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 80 | first_ch_no = assoc_req->supportedChannels.supportedChannels[i]; |
| 81 | assoc_ind->supportedChannels.channelList[index] = first_ch_no; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 82 | i++; |
| 83 | index++; |
| 84 | |
| 85 | /* Get Number of Channels in a Subband */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 86 | chn_count = assoc_req->supportedChannels.supportedChannels[i]; |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 87 | pe_debug("Rcv assoc_req: chnl: %d numOfChnl: %d", |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 88 | first_ch_no, chn_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 89 | if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 90 | pe_warn("Ch count > max supported: %d", chn_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 91 | assoc_ind->supportedChannels.numChnl = 0; |
| 92 | return; |
| 93 | } |
| 94 | if (chn_count <= 1) |
| 95 | continue; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 96 | next_ch_no = first_ch_no; |
Amruta Kulkarni | 453c4e2 | 2019-11-20 10:59:21 -0800 | [diff] [blame] | 97 | chan_freq = wlan_reg_legacy_chan_to_freq(mac_ctx->pdev, |
| 98 | first_ch_no); |
| 99 | |
| 100 | if (REG_BAND_5G == lim_get_rf_band(chan_freq)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 101 | channel_offset = SIR_11A_FREQUENCY_OFFSET; |
Amruta Kulkarni | 453c4e2 | 2019-11-20 10:59:21 -0800 | [diff] [blame] | 102 | else if (REG_BAND_2G == lim_get_rf_band(chan_freq)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 103 | channel_offset = SIR_11B_FREQUENCY_OFFSET; |
| 104 | else |
| 105 | continue; |
| 106 | |
| 107 | for (j = 1; j < chn_count; j++) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 108 | next_ch_no += channel_offset; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 109 | assoc_ind->supportedChannels.channelList[index] |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 110 | = next_ch_no; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 111 | index++; |
| 112 | if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 113 | pe_warn("Ch count > supported: %d", chn_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 114 | assoc_ind->supportedChannels.numChnl = 0; |
| 115 | return; |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | assoc_ind->supportedChannels.numChnl = (uint8_t) index; |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 121 | pe_debug("Send AssocInd to WSM: minPwr: %d maxPwr: %d numChnl: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 122 | assoc_ind->powerCap.minTxPower, |
| 123 | assoc_ind->powerCap.maxTxPower, |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 124 | assoc_ind->supportedChannels.numChnl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 125 | } |
| 126 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 127 | /** |
| 128 | * lim_check_sta_in_pe_entries() - checks if sta exists in any dph tables. |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 129 | * @mac_ctx: Pointer to Global MAC structure |
| 130 | * @hdr: A pointer to the MAC header |
Poddar, Siddarth | 7ca1e08 | 2016-08-09 19:06:48 +0530 | [diff] [blame] | 131 | * @sessionid - session id for which session is initiated |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 132 | * @dup_entry: pointer for duplicate entry found |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 133 | * |
| 134 | * This function is called by lim_process_assoc_req_frame() to check if STA |
| 135 | * entry already exists in any of the PE entries of the AP. If it exists, deauth |
| 136 | * will be sent on that session and the STA deletion will happen. After this, |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 137 | * the ASSOC request will be processed. If the STA is already in deleting phase |
| 138 | * this will return failure so that assoc req will be rejected till STA is |
| 139 | * deleted. |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 140 | * |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 141 | * Return: QDF_STATUS. |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 142 | */ |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 143 | static QDF_STATUS lim_check_sta_in_pe_entries(struct mac_context *mac_ctx, |
| 144 | tpSirMacMgmtHdr hdr, |
| 145 | uint16_t sessionid, |
| 146 | bool *dup_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 147 | { |
| 148 | uint8_t i; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 149 | uint16_t assoc_id = 0; |
| 150 | tpDphHashNode sta_ds = NULL; |
Jeff Johnson | eac5aad | 2019-03-19 12:57:04 -0700 | [diff] [blame] | 151 | struct pe_session *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 152 | |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 153 | *dup_entry = false; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 154 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) { |
Jeff Johnson | eac5aad | 2019-03-19 12:57:04 -0700 | [diff] [blame] | 155 | session = &mac_ctx->lim.gpSession[i]; |
| 156 | if (session->valid && |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 157 | (session->opmode == QDF_SAP_MODE)) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 158 | sta_ds = dph_lookup_hash_entry(mac_ctx, hdr->sa, |
| 159 | &assoc_id, &session->dph.dphHashTable); |
| 160 | if (sta_ds |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 161 | #ifdef WLAN_FEATURE_11W |
Poddar, Siddarth | 7ca1e08 | 2016-08-09 19:06:48 +0530 | [diff] [blame] | 162 | && (!sta_ds->rmfEnabled || |
| 163 | (sessionid != session->peSessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 164 | #endif |
| 165 | ) { |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 166 | if (sta_ds->mlmStaContext.mlmState == |
| 167 | eLIM_MLM_WT_DEL_STA_RSP_STATE || |
| 168 | sta_ds->mlmStaContext.mlmState == |
| 169 | eLIM_MLM_WT_DEL_BSS_RSP_STATE || |
| 170 | sta_ds->sta_deletion_in_progress) { |
| 171 | pe_debug( |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 172 | "Deletion is in progress (%d) for peer:"QDF_MAC_ADDR_FMT" in mlmState %d", |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 173 | sta_ds->sta_deletion_in_progress, |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 174 | QDF_MAC_ADDR_REF(sta_ds->staAddr), |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 175 | sta_ds->mlmStaContext.mlmState); |
| 176 | *dup_entry = true; |
| 177 | return QDF_STATUS_E_AGAIN; |
| 178 | } |
| 179 | sta_ds->sta_deletion_in_progress = true; |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 180 | pe_err("Sending Disassoc and Deleting existing STA entry:" |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 181 | QDF_MAC_ADDR_FMT, |
| 182 | QDF_MAC_ADDR_REF( |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 183 | session->self_mac_addr)); |
Sandeep Puligilla | 2eeaf6a | 2016-07-22 20:02:02 -0700 | [diff] [blame] | 184 | lim_send_disassoc_mgmt_frame(mac_ctx, |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 185 | eSIR_MAC_UNSPEC_FAILURE_REASON, |
| 186 | (uint8_t *) hdr->sa, session, false); |
Sandeep Puligilla | 2eeaf6a | 2016-07-22 20:02:02 -0700 | [diff] [blame] | 187 | /* |
| 188 | * Cleanup Rx path posts eWNI_SME_DISASSOC_RSP |
| 189 | * msg to SME after delete sta which will update |
| 190 | * the userspace with disconnect |
| 191 | */ |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 192 | sta_ds->mlmStaContext.cleanupTrigger = |
| 193 | eLIM_DUPLICATE_ENTRY; |
| 194 | sta_ds->mlmStaContext.disassocReason = |
| 195 | eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON; |
| 196 | lim_send_sme_disassoc_ind(mac_ctx, sta_ds, |
| 197 | session); |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 198 | *dup_entry = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 199 | break; |
| 200 | } |
| 201 | } |
| 202 | } |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 203 | |
| 204 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 205 | } |
| 206 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 207 | /** |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 208 | * lim_chk_sa_da() - checks source addr to destination addr of assoc req frame |
| 209 | * @mac_ctx: pointer to Global MAC structure |
| 210 | * @hdr: pointer to the MAC head |
| 211 | * @session: pointer to pe session entry |
| 212 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 213 | * |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 214 | * Checks source addr to destination addr of assoc req frame |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 215 | * |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 216 | * Return: true if source and destination address are different |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 217 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 218 | static bool lim_chk_sa_da(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 219 | struct pe_session *session, uint8_t sub_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 220 | { |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 221 | if (qdf_mem_cmp((uint8_t *) hdr->sa, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 222 | (uint8_t *) hdr->da, |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 223 | (uint8_t) (sizeof(tSirMacAddr)))) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 224 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 225 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 226 | pe_err("Assoc Req rejected: wlan.sa = wlan.da"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 227 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_UNSPEC_FAILURE_STATUS, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 228 | 1, hdr->sa, sub_type, 0, session, false); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 229 | return false; |
| 230 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 231 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 232 | /** |
| 233 | * lim_chk_tkip() - checks TKIP counter measure is active |
| 234 | * @mac_ctx: pointer to Global MAC structure |
| 235 | * @hdr: pointer to the MAC head |
| 236 | * @session: pointer to pe session entry |
| 237 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 238 | * |
| 239 | * Checks TKIP counter measure is active |
| 240 | * |
| 241 | * Return: true of no error, false otherwise |
| 242 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 243 | static bool lim_chk_tkip(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 244 | struct pe_session *session, uint8_t sub_type) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 245 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 246 | /* |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 247 | * If TKIP counter measures active send Assoc Rsp frame to station |
| 248 | * with eSIR_MAC_MIC_FAILURE_REASON |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 249 | */ |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 250 | if (!(session->bTkipCntrMeasActive && LIM_IS_AP_ROLE(session))) |
| 251 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 252 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 253 | pe_err("Assoc Req rejected: TKIP counter measure is active"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 254 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_MIC_FAILURE_REASON, 1, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 255 | hdr->sa, sub_type, 0, session, false); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 256 | return false; |
| 257 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 258 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 259 | /** |
| 260 | * lim_chk_assoc_req_parse_error() - checks for error in frame parsing |
| 261 | * @mac_ctx: pointer to Global MAC structure |
| 262 | * @hdr: pointer to the MAC head |
| 263 | * @session: pointer to pe session entry |
| 264 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 265 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 266 | * @frm_body: frame body |
| 267 | * @frame_len: frame len |
| 268 | * |
| 269 | * Checks for error in frame parsing |
| 270 | * |
| 271 | * Return: true of no error, false otherwise |
| 272 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 273 | static bool lim_chk_assoc_req_parse_error(struct mac_context *mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 274 | tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 275 | struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 276 | tpSirAssocReq assoc_req, |
| 277 | uint8_t sub_type, uint8_t *frm_body, |
Krishna Kumaar Natarajan | db582ec | 2016-03-08 17:37:04 -0800 | [diff] [blame] | 278 | uint32_t frame_len) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 279 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 280 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 281 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 282 | if (sub_type == LIM_ASSOC) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 283 | status = sir_convert_assoc_req_frame2_struct(mac_ctx, frm_body, |
Pragaspathi Thilagaraj | 0bd369d | 2019-04-08 00:07:53 +0530 | [diff] [blame] | 284 | frame_len, |
| 285 | assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 286 | else |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 287 | status = sir_convert_reassoc_req_frame2_struct(mac_ctx, |
| 288 | frm_body, frame_len, assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 289 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 290 | if (status == QDF_STATUS_SUCCESS) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 291 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 292 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 293 | pe_warn("Assoc Req rejected: frame parsing error. source addr:" |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 294 | QDF_MAC_ADDR_FMT, QDF_MAC_ADDR_REF(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 295 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_UNSPEC_FAILURE_STATUS, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 296 | 1, hdr->sa, sub_type, 0, session, false); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 297 | return false; |
| 298 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 299 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 300 | /** |
| 301 | * lim_chk_capab() - checks for capab match |
| 302 | * @mac_ctx: pointer to Global MAC structure |
| 303 | * @hdr: pointer to the MAC head |
| 304 | * @session: pointer to pe session entry |
| 305 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 306 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 307 | * @local_cap: local capabilities of SAP |
| 308 | * |
| 309 | * Checks for capab match |
| 310 | * |
| 311 | * Return: true of no error, false otherwise |
| 312 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 313 | static bool lim_chk_capab(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 314 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 315 | uint8_t sub_type, tSirMacCapabilityInfo *local_cap) |
| 316 | { |
| 317 | uint16_t temp; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 318 | |
Wu Gao | 5c3d94b | 2019-01-17 21:15:54 +0800 | [diff] [blame] | 319 | if (lim_get_capability_info(mac_ctx, &temp, session) != |
| 320 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 321 | pe_err("could not retrieve Capabilities"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 322 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 323 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 324 | |
| 325 | lim_copy_u16((uint8_t *) local_cap, temp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 326 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 327 | if (lim_compare_capabilities(mac_ctx, assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 328 | local_cap, session) == false) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 329 | pe_warn("Rcvd %s Req with unsupported capab from" |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 330 | QDF_MAC_ADDR_FMT, |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 331 | (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 332 | QDF_MAC_ADDR_REF(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 333 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 334 | * Capabilities of requesting STA does not match with |
| 335 | * local capabilities. Respond with 'unsupported capabilities' |
| 336 | * status code. |
| 337 | */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 338 | lim_send_assoc_rsp_mgmt_frame( |
| 339 | mac_ctx, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 340 | 1, hdr->sa, sub_type, 0, session, false); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 341 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 342 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 343 | return true; |
| 344 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 345 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 346 | /** |
| 347 | * lim_chk_ssid() - checks for SSID match |
| 348 | * @mac_ctx: pointer to Global MAC structure |
| 349 | * @hdr: pointer to the MAC head |
| 350 | * @session: pointer to pe session entry |
| 351 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 352 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 353 | * |
| 354 | * Checks for SSID match |
| 355 | * |
| 356 | * Return: true of no error, false otherwise |
| 357 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 358 | static bool lim_chk_ssid(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 359 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 360 | uint8_t sub_type) |
| 361 | { |
| 362 | if (lim_cmp_ssid(&assoc_req->ssId, session) != true) |
| 363 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 364 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 365 | pe_err("%s Req with ssid wrong(Rcvd: %.*s self: %.*s) from " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 366 | QDF_MAC_ADDR_FMT, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 367 | (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", |
| 368 | assoc_req->ssId.length, assoc_req->ssId.ssId, |
| 369 | session->ssId.length, session->ssId.ssId, |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 370 | QDF_MAC_ADDR_REF(hdr->sa)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 371 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 372 | /* |
| 373 | * Received Re/Association Request with either Broadcast SSID OR with |
| 374 | * SSID that does not match with local one. Respond with unspecified |
| 375 | * status code. |
| 376 | */ |
| 377 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_UNSPEC_FAILURE_STATUS, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 378 | 1, hdr->sa, sub_type, 0, session, false); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 379 | return false; |
| 380 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 381 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 382 | /** |
| 383 | * lim_chk_rates() - checks for supported rates |
| 384 | * @mac_ctx: pointer to Global MAC structure |
| 385 | * @hdr: pointer to the MAC head |
| 386 | * @session: pointer to pe session entry |
| 387 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 388 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 389 | * |
| 390 | * Checks for supported rates |
| 391 | * |
| 392 | * Return: true of no error, false otherwise |
| 393 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 394 | static bool lim_chk_rates(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 395 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 396 | uint8_t sub_type) |
| 397 | { |
| 398 | uint8_t i = 0, j = 0; |
| 399 | tSirMacRateSet basic_rates; |
| 400 | /* |
| 401 | * Verify if the requested rates are available in supported rate |
| 402 | * set or Extended rate set. Some APs are adding basic rates in |
| 403 | * Extended rateset IE |
| 404 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 405 | basic_rates.numRates = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 406 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 407 | for (i = 0; i < assoc_req->supportedRates.numRates |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 408 | && (i < WLAN_SUPPORTED_RATES_IE_MAX_LEN); i++) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 409 | basic_rates.rate[i] = assoc_req->supportedRates.rate[i]; |
| 410 | basic_rates.numRates++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 411 | } |
| 412 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 413 | for (j = 0; (j < assoc_req->extendedRates.numRates) |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 414 | && (i < WLAN_SUPPORTED_RATES_IE_MAX_LEN); i++, j++) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 415 | basic_rates.rate[i] = assoc_req->extendedRates.rate[j]; |
| 416 | basic_rates.numRates++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 417 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 418 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 419 | if (lim_check_rx_basic_rates(mac_ctx, basic_rates, session) == true) |
| 420 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 421 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 422 | pe_warn("Assoc Req rejected: unsupported rates, soruce addr: %s" |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 423 | QDF_MAC_ADDR_FMT, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 424 | (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 425 | QDF_MAC_ADDR_REF(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 426 | /* |
| 427 | * Requesting STA does not support ALL BSS basic rates. Respond with |
| 428 | * 'basic rates not supported' status code. |
| 429 | */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 430 | lim_send_assoc_rsp_mgmt_frame( |
| 431 | mac_ctx, eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS, 1, |
| 432 | hdr->sa, sub_type, 0, session, false); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 433 | return false; |
| 434 | } |
| 435 | |
| 436 | /** |
| 437 | * lim_chk_11g_only() - checks for non 11g STA |
| 438 | * @mac_ctx: pointer to Global MAC structure |
| 439 | * @hdr: pointer to the MAC head |
| 440 | * @session: pointer to pe session entry |
| 441 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 442 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 443 | * |
| 444 | * Checks for non 11g STA |
| 445 | * |
| 446 | * Return: true of no error, false otherwise |
| 447 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 448 | static bool lim_chk_11g_only(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 449 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 450 | uint8_t sub_type) |
| 451 | { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 452 | if (LIM_IS_AP_ROLE(session) && |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 453 | (session->dot11mode == MLME_DOT11_MODE_11G_ONLY) && |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 454 | (assoc_req->HTCaps.present)) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 455 | pe_err("SOFTAP was in 11G only mode, rejecting legacy STA: " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 456 | QDF_MAC_ADDR_FMT, |
| 457 | QDF_MAC_ADDR_REF(hdr->sa)); |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 458 | lim_send_assoc_rsp_mgmt_frame( |
| 459 | mac_ctx, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 460 | 1, hdr->sa, sub_type, 0, session, false); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 461 | return false; |
| 462 | } |
| 463 | return true; |
| 464 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 465 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 466 | /** |
| 467 | * lim_chk_11n_only() - checks for non 11n STA |
| 468 | * @mac_ctx: pointer to Global MAC structure |
| 469 | * @hdr: pointer to the MAC head |
| 470 | * @session: pointer to pe session entry |
| 471 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 472 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 473 | * |
| 474 | * Checks for non 11n STA |
| 475 | * |
| 476 | * Return: true of no error, false otherwise |
| 477 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 478 | static bool lim_chk_11n_only(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 479 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 480 | uint8_t sub_type) |
| 481 | { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 482 | if (LIM_IS_AP_ROLE(session) && |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 483 | (session->dot11mode == MLME_DOT11_MODE_11N_ONLY) && |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 484 | (!assoc_req->HTCaps.present)) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 485 | pe_err("SOFTAP was in 11N only mode, rejecting legacy STA: " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 486 | QDF_MAC_ADDR_FMT, |
| 487 | QDF_MAC_ADDR_REF(hdr->sa)); |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 488 | lim_send_assoc_rsp_mgmt_frame( |
| 489 | mac_ctx, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 490 | 1, hdr->sa, sub_type, 0, session, false); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 491 | return false; |
| 492 | } |
| 493 | return true; |
| 494 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 495 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 496 | /** |
| 497 | * lim_chk_11ac_only() - checks for non 11ac STA |
| 498 | * @mac_ctx: pointer to Global MAC structure |
| 499 | * @hdr: pointer to the MAC head |
| 500 | * @session: pointer to pe session entry |
| 501 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 502 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 503 | * |
| 504 | * Checks for non 11ac STA |
| 505 | * |
| 506 | * Return: true of no error, false otherwise |
| 507 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 508 | static bool lim_chk_11ac_only(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 509 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 510 | uint8_t sub_type) |
| 511 | { |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 512 | tDot11fIEVHTCaps *vht_caps; |
| 513 | |
| 514 | if (assoc_req->VHTCaps.present) |
| 515 | vht_caps = &assoc_req->VHTCaps; |
| 516 | else if (assoc_req->vendor_vht_ie.VHTCaps.present && |
| 517 | session->vendor_vht_sap) |
| 518 | vht_caps = &assoc_req->vendor_vht_ie.VHTCaps; |
| 519 | else |
| 520 | vht_caps = NULL; |
| 521 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 522 | if (LIM_IS_AP_ROLE(session) && |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 523 | (session->dot11mode == MLME_DOT11_MODE_11AC_ONLY) && |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 524 | ((!vht_caps) || ((vht_caps) && (!vht_caps->present)))) { |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 525 | lim_send_assoc_rsp_mgmt_frame( |
| 526 | mac_ctx, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 527 | 1, hdr->sa, sub_type, 0, session, false); |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 528 | pe_err("SOFTAP was in 11AC only mode, reject"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 529 | return false; |
| 530 | } |
| 531 | return true; |
| 532 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 533 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 534 | /** |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 535 | * lim_chk_11ax_only() - checks for non 11ax STA |
| 536 | * @mac_ctx: pointer to Global MAC structure |
| 537 | * @hdr: pointer to the MAC head |
| 538 | * @session: pointer to pe session entry |
| 539 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 540 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 541 | * |
| 542 | * Checks for non 11ax STA |
| 543 | * |
| 544 | * Return: true of no error, false otherwise |
| 545 | */ |
| 546 | #ifdef WLAN_FEATURE_11AX |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 547 | static bool lim_chk_11ax_only(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 548 | struct pe_session *session, tpSirAssocReq assoc_req, |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 549 | uint8_t sub_type) |
| 550 | { |
| 551 | if (LIM_IS_AP_ROLE(session) && |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 552 | (session->dot11mode == MLME_DOT11_MODE_11AX_ONLY) && |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 553 | !assoc_req->he_cap.present) { |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 554 | lim_send_assoc_rsp_mgmt_frame( |
| 555 | mac_ctx, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 556 | 1, hdr->sa, sub_type, 0, session, false); |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 557 | pe_err("SOFTAP was in 11AX only mode, reject"); |
| 558 | return false; |
| 559 | } |
| 560 | return true; |
| 561 | } |
| 562 | |
| 563 | /** |
| 564 | * lim_check_11ax_basic_mcs() - checks for 11ax basic MCS rates |
| 565 | * @mac_ctx: pointer to Global MAC structure |
| 566 | * @hdr: pointer to the MAC head |
| 567 | * @session: pointer to pe session entry |
| 568 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 569 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 570 | * |
| 571 | * Checks for non 11ax STA |
| 572 | * |
| 573 | * Return: true of no error, false otherwise |
| 574 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 575 | static bool lim_check_11ax_basic_mcs(struct mac_context *mac_ctx, |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 576 | tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 577 | struct pe_session *session, |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 578 | tpSirAssocReq assoc_req, |
| 579 | uint8_t sub_type) |
| 580 | { |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 581 | uint16_t basic_mcs, sta_mcs, rx_mcs, tx_mcs, final_mcs; |
| 582 | |
| 583 | if (LIM_IS_AP_ROLE(session) && |
| 584 | assoc_req->he_cap.present) { |
| 585 | rx_mcs = assoc_req->he_cap.rx_he_mcs_map_lt_80; |
| 586 | tx_mcs = assoc_req->he_cap.tx_he_mcs_map_lt_80; |
| 587 | sta_mcs = HE_INTERSECT_MCS(rx_mcs, tx_mcs); |
Bala Venkatesh | 6d53709 | 2018-09-25 10:38:36 +0530 | [diff] [blame] | 588 | basic_mcs = |
| 589 | (uint16_t)mac_ctx->mlme_cfg->he_caps.he_ops_basic_mcs_nss; |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 590 | final_mcs = HE_INTERSECT_MCS(sta_mcs, basic_mcs); |
| 591 | if (final_mcs != basic_mcs) { |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 592 | lim_send_assoc_rsp_mgmt_frame( |
| 593 | mac_ctx, |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 594 | eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 595 | 1, hdr->sa, sub_type, 0, session, false); |
Jeff Johnson | a642ead | 2018-05-11 09:26:13 -0700 | [diff] [blame] | 596 | pe_err("STA did not support basic MCS required by SAP"); |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 597 | return false; |
| 598 | } |
| 599 | } |
| 600 | return true; |
| 601 | } |
Bala Venkatesh | 6d53709 | 2018-09-25 10:38:36 +0530 | [diff] [blame] | 602 | |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 603 | #else |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 604 | static bool lim_chk_11ax_only(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 605 | struct pe_session *session, tpSirAssocReq assoc_req, |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 606 | uint8_t sub_type) |
| 607 | { |
| 608 | return true; |
| 609 | } |
| 610 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 611 | static bool lim_check_11ax_basic_mcs(struct mac_context *mac_ctx, |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 612 | tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 613 | struct pe_session *session, |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 614 | tpSirAssocReq assoc_req, |
| 615 | uint8_t sub_type) |
| 616 | { |
| 617 | return true; |
| 618 | } |
| 619 | #endif |
| 620 | |
| 621 | /** |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 622 | * lim_process_for_spectrum_mgmt() - process assoc req for spectrum mgmt |
| 623 | * @mac_ctx: pointer to Global MAC structure |
| 624 | * @hdr: pointer to the MAC head |
| 625 | * @session: pointer to pe session entry |
| 626 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 627 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 628 | * @local_cap: local capabilities of SAP |
| 629 | * |
| 630 | * Checks for SSID match |
| 631 | * |
| 632 | * process assoc req for spectrum mgmt |
| 633 | */ |
| 634 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 635 | lim_process_for_spectrum_mgmt(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 636 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 637 | uint8_t sub_type, tSirMacCapabilityInfo local_cap) |
| 638 | { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 639 | if (local_cap.spectrumMgt) { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 640 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 641 | /* |
| 642 | * If station is 11h capable, then it SHOULD send all mandatory |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 643 | * IEs in assoc request frame. Let us verify that |
| 644 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 645 | if (assoc_req->capabilityInfo.spectrumMgt) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 646 | if (!((assoc_req->powerCapabilityPresent) |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 647 | && (assoc_req->supportedChannelsPresent))) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 648 | /* |
| 649 | * One or more required information elements are |
| 650 | * missing, log the peers error |
| 651 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 652 | if (!assoc_req->powerCapabilityPresent) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 653 | pe_warn("LIM Info: Missing Power capability IE in %s Req from " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 654 | QDF_MAC_ADDR_FMT, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 655 | (LIM_ASSOC == sub_type) ? |
| 656 | "Assoc" : "ReAssoc", |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 657 | QDF_MAC_ADDR_REF(hdr->sa)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 658 | } |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 659 | if (!assoc_req->supportedChannelsPresent) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 660 | pe_warn("LIM Info: Missing Supported channel IE in %s Req from " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 661 | QDF_MAC_ADDR_FMT, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 662 | (LIM_ASSOC == sub_type) ? |
| 663 | "Assoc" : "ReAssoc", |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 664 | QDF_MAC_ADDR_REF(hdr->sa)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 665 | } |
| 666 | } else { |
| 667 | /* Assoc request has mandatory fields */ |
| 668 | status = |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 669 | lim_is_dot11h_power_capabilities_in_range( |
| 670 | mac_ctx, assoc_req, session); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 671 | if (QDF_STATUS_SUCCESS != status) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 672 | pe_warn("LIM Info: MinTxPower(STA) > MaxTxPower(AP) in %s Req from " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 673 | QDF_MAC_ADDR_FMT, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 674 | (LIM_ASSOC == sub_type) ? |
| 675 | "Assoc" : "ReAssoc", |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 676 | QDF_MAC_ADDR_REF(hdr->sa)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 677 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 678 | status = lim_is_dot11h_supported_channels_valid( |
| 679 | mac_ctx, assoc_req); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 680 | if (QDF_STATUS_SUCCESS != status) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 681 | pe_warn("LIM Info: wrong supported channels (STA) in %s Req from " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 682 | QDF_MAC_ADDR_FMT, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 683 | (LIM_ASSOC == sub_type) ? |
| 684 | "Assoc" : "ReAssoc", |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 685 | QDF_MAC_ADDR_REF(hdr->sa)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 686 | } |
| 687 | /* IEs are valid, use them if needed */ |
| 688 | } |
| 689 | } /* if(assoc.capabilityInfo.spectrumMgt) */ |
| 690 | else { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 691 | /* |
| 692 | * As per the capabiities, the spectrum management is |
| 693 | * not enabled on the station. The AP may allow the |
| 694 | * associations to happen even if spectrum management |
| 695 | * is not allowed, if the transmit power of station is |
| 696 | * below the regulatory maximum |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 697 | */ |
| 698 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 699 | /* |
| 700 | * TODO: presently, this is not handled. In the current |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 701 | * implementation, the AP would allow the station to |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 702 | * associate even if it doesn't support spectrum |
| 703 | * management. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 704 | */ |
| 705 | } |
| 706 | } /* end of spectrum management related processing */ |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 707 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 708 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 709 | /** |
| 710 | * lim_chk_mcs() - checks for supported MCS |
| 711 | * @mac_ctx: pointer to Global MAC structure |
| 712 | * @hdr: pointer to the MAC head |
| 713 | * @session: pointer to pe session entry |
| 714 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 715 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 716 | * |
| 717 | * Checks for supported MCS |
| 718 | * |
| 719 | * Return: true of no error, false otherwise |
| 720 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 721 | static bool lim_chk_mcs(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 722 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 723 | uint8_t sub_type) |
| 724 | { |
| 725 | if ((assoc_req->HTCaps.present) && (lim_check_mcs_set(mac_ctx, |
| 726 | assoc_req->HTCaps.supportedMCSSet) == false)) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 727 | pe_warn("rcvd %s req with unsupported MCS Rate Set from " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 728 | QDF_MAC_ADDR_FMT, |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 729 | (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 730 | QDF_MAC_ADDR_REF(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 731 | /* |
| 732 | * Requesting STA does not support ALL BSS MCS basic Rate set |
| 733 | * rates. Spec does not define any status code for this |
| 734 | * scenario. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 735 | */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 736 | lim_send_assoc_rsp_mgmt_frame( |
| 737 | mac_ctx, eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS, |
| 738 | 1, hdr->sa, sub_type, 0, session, false); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 739 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 740 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 741 | return true; |
| 742 | } |
| 743 | |
| 744 | /** |
| 745 | * lim_chk_is_11b_sta_supported() - checks if STA is 11b |
| 746 | * @mac_ctx: pointer to Global MAC structure |
| 747 | * @hdr: pointer to the MAC head |
| 748 | * @session: pointer to pe session entry |
| 749 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 750 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 751 | * @phy_mode: phy mode |
| 752 | * |
| 753 | * Checks if STA is 11b |
| 754 | * |
| 755 | * Return: true of no error, false otherwise |
| 756 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 757 | static bool lim_chk_is_11b_sta_supported(struct mac_context *mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 758 | tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 759 | struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 760 | tpSirAssocReq assoc_req, |
| 761 | uint8_t sub_type, uint32_t phy_mode) |
| 762 | { |
| 763 | uint32_t cfg_11g_only; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 764 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 765 | if (phy_mode == WNI_CFG_PHY_MODE_11G) { |
Bala Venkatesh | 2fde2c6 | 2018-09-11 20:33:24 +0530 | [diff] [blame] | 766 | cfg_11g_only = mac_ctx->mlme_cfg->sap_cfg.sap_11g_policy; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 767 | if (!assoc_req->extendedRatesPresent && cfg_11g_only) { |
| 768 | /* |
| 769 | * Received Re/Association Request from 11b STA when 11g |
| 770 | * only policy option is set. Reject with unspecified |
| 771 | * status code. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 772 | */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 773 | lim_send_assoc_rsp_mgmt_frame( |
| 774 | mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 775 | eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 776 | 1, hdr->sa, sub_type, 0, session, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 777 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 778 | pe_warn("Rejecting Re/Assoc req from 11b STA:"); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 779 | lim_print_mac_addr(mac_ctx, hdr->sa, LOGW); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 780 | |
| 781 | #ifdef WLAN_DEBUG |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 782 | mac_ctx->lim.gLim11bStaAssocRejectCount++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 783 | #endif |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 784 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 785 | } |
| 786 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 787 | return true; |
| 788 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 789 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 790 | /** |
| 791 | * lim_print_ht_cap() - prints HT caps |
| 792 | * @mac_ctx: pointer to Global MAC structure |
| 793 | * @session: pointer to pe session entry |
| 794 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 795 | * |
| 796 | * Prints HT caps |
| 797 | * |
| 798 | * Return: void |
| 799 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 800 | static void lim_print_ht_cap(struct mac_context *mac_ctx, struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 801 | tpSirAssocReq assoc_req) |
| 802 | { |
| 803 | if (!session->htCapability) |
| 804 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 805 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 806 | if (assoc_req->HTCaps.present) { |
| 807 | /* The station *does* support 802.11n HT capability... */ |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 808 | pe_debug("AdvCodingCap:%d ChaWidthSet:%d PowerSave:%d greenField:%d shortGI20:%d shortGI40:%d txSTBC:%d rxSTBC:%d delayBA:%d maxAMSDUsize:%d DSSS/CCK:%d PSMP:%d stbcCntl:%d lsigTXProt:%d", |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 809 | assoc_req->HTCaps.advCodingCap, |
| 810 | assoc_req->HTCaps.supportedChannelWidthSet, |
| 811 | assoc_req->HTCaps.mimoPowerSave, |
| 812 | assoc_req->HTCaps.greenField, |
| 813 | assoc_req->HTCaps.shortGI20MHz, |
| 814 | assoc_req->HTCaps.shortGI40MHz, |
| 815 | assoc_req->HTCaps.txSTBC, |
| 816 | assoc_req->HTCaps.rxSTBC, |
| 817 | assoc_req->HTCaps.delayedBA, |
| 818 | assoc_req->HTCaps.maximalAMSDUsize, |
| 819 | assoc_req->HTCaps.dsssCckMode40MHz, |
| 820 | assoc_req->HTCaps.psmp, |
| 821 | assoc_req->HTCaps.stbcControlFrame, |
| 822 | assoc_req->HTCaps.lsigTXOPProtection); |
| 823 | /* |
| 824 | * Make sure the STA's caps are compatible with our own: |
| 825 | * 11.15.2 Support of DSSS/CCK in 40 MHz the AP shall refuse |
| 826 | * association requests from an HT STA that has the DSSS/CCK |
| 827 | * Mode in 40 MHz subfield set to 1; |
| 828 | */ |
| 829 | } |
| 830 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 831 | |
Nirav Shah | ba3eecf | 2020-02-17 19:38:35 +0530 | [diff] [blame] | 832 | static enum mac_status_code |
| 833 | lim_check_crypto_param(tpSirAssocReq assoc_req, |
| 834 | struct wlan_crypto_params *peer_crypto_params) |
| 835 | { |
| 836 | /* TKIP/WEP is not allowed in HT/VHT mode*/ |
| 837 | if (assoc_req->HTCaps.present) { |
| 838 | if ((peer_crypto_params->ucastcipherset & |
| 839 | (1 << WLAN_CRYPTO_CIPHER_TKIP)) || |
| 840 | (peer_crypto_params->ucastcipherset & |
| 841 | (1 << WLAN_CRYPTO_CIPHER_WEP))) { |
| 842 | pe_info("TKIP/WEP cipher with HT supported client, reject assoc"); |
| 843 | return eSIR_MAC_INVALID_IE_STATUS; |
| 844 | } |
| 845 | } |
| 846 | return eSIR_MAC_SUCCESS_STATUS; |
| 847 | } |
| 848 | |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 849 | static |
| 850 | enum mac_status_code lim_check_rsn_ie(struct pe_session *session, |
| 851 | struct mac_context *mac_ctx, |
| 852 | tpSirAssocReq assoc_req, |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 853 | bool *pmf_connection) |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 854 | { |
| 855 | struct wlan_objmgr_vdev *vdev; |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 856 | tSirMacRsnInfo rsn_ie; |
Nirav Shah | ba3eecf | 2020-02-17 19:38:35 +0530 | [diff] [blame] | 857 | struct wlan_crypto_params peer_crypto_params; |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 858 | |
Abhishek Singh | 6c39a98 | 2020-05-19 20:51:45 +0530 | [diff] [blame] | 859 | rsn_ie.info[0] = WLAN_ELEMID_RSN; |
| 860 | rsn_ie.info[1] = assoc_req->rsn.length; |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 861 | |
Abhishek Singh | 6c39a98 | 2020-05-19 20:51:45 +0530 | [diff] [blame] | 862 | rsn_ie.length = assoc_req->rsn.length + 2; |
| 863 | qdf_mem_copy(&rsn_ie.info[2], assoc_req->rsn.info, |
| 864 | assoc_req->rsn.length); |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 865 | if (wlan_crypto_check_rsn_match(mac_ctx->psoc, session->smeSessionId, |
Nirav Shah | ba3eecf | 2020-02-17 19:38:35 +0530 | [diff] [blame] | 866 | &rsn_ie.info[0], rsn_ie.length, |
| 867 | &peer_crypto_params)) { |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 868 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac_ctx->psoc, |
| 869 | session->smeSessionId, |
| 870 | WLAN_LEGACY_MAC_ID); |
| 871 | if (!vdev) { |
| 872 | pe_err("vdev is NULL"); |
| 873 | return eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 874 | } |
Utkarsh Bhatnagar | 5952ff5 | 2020-05-17 18:29:20 +0530 | [diff] [blame] | 875 | if ((peer_crypto_params.rsn_caps & |
| 876 | WLAN_CRYPTO_RSN_CAP_MFP_ENABLED) && |
| 877 | wlan_crypto_vdev_is_pmf_enabled(vdev)) |
| 878 | *pmf_connection = true; |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 879 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 880 | wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID); |
Nirav Shah | ba3eecf | 2020-02-17 19:38:35 +0530 | [diff] [blame] | 881 | return lim_check_crypto_param(assoc_req, &peer_crypto_params); |
| 882 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 883 | } else { |
| 884 | return eSIR_MAC_INVALID_IE_STATUS; |
| 885 | } |
| 886 | |
| 887 | return eSIR_MAC_SUCCESS_STATUS; |
| 888 | } |
| 889 | |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 890 | static enum mac_status_code lim_check_wpa_ie(struct pe_session *session, |
| 891 | struct mac_context *mac_ctx, |
| 892 | tpSirAssocReq assoc_req, |
| 893 | tDot11fIEWPA *wpa) |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 894 | { |
Srinivas Girigowda | cf16140 | 2019-03-14 11:37:33 -0700 | [diff] [blame] | 895 | uint8_t buffer[WLAN_MAX_IE_LEN]; |
| 896 | uint32_t dot11f_status, written = 0, nbuffer = WLAN_MAX_IE_LEN; |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 897 | tSirMacRsnInfo wpa_ie = {0}; |
Nirav Shah | ba3eecf | 2020-02-17 19:38:35 +0530 | [diff] [blame] | 898 | struct wlan_crypto_params peer_crypto_params; |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 899 | |
| 900 | dot11f_status = dot11f_pack_ie_wpa(mac_ctx, wpa, buffer, |
| 901 | nbuffer, &written); |
| 902 | if (DOT11F_FAILED(dot11f_status)) { |
| 903 | pe_err("Failed to re-pack the RSN IE (0x%0x8)", dot11f_status); |
| 904 | return eSIR_MAC_INVALID_IE_STATUS; |
| 905 | } |
| 906 | |
| 907 | wpa_ie.length = (uint8_t) written; |
| 908 | qdf_mem_copy(&wpa_ie.info[0], buffer, wpa_ie.length); |
| 909 | if (wlan_crypto_check_wpa_match(mac_ctx->psoc, session->smeSessionId, |
Nirav Shah | ba3eecf | 2020-02-17 19:38:35 +0530 | [diff] [blame] | 910 | &wpa_ie.info[0], wpa_ie.length, |
| 911 | &peer_crypto_params)) { |
| 912 | return lim_check_crypto_param(assoc_req, &peer_crypto_params); |
| 913 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 914 | |
| 915 | return eSIR_MAC_INVALID_IE_STATUS; |
| 916 | } |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 917 | |
| 918 | /** |
| 919 | * lim_check_sae_pmf_cap() - check pmf capability for SAE STA |
| 920 | * @session: pointer to pe session entry |
| 921 | * @rsn: pointer to RSN |
Yu Ouyang | 228afe9 | 2019-08-12 18:01:56 +0800 | [diff] [blame] | 922 | * @akm_type: AKM type |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 923 | * |
| 924 | * This function checks if SAE STA is pmf capable when SAE SAP is pmf |
| 925 | * capable. Reject with eSIR_MAC_ROBUST_MGMT_FRAMES_POLICY_VIOLATION |
| 926 | * if SAE STA is pmf disable. |
| 927 | * |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 928 | * Return: mac_status_code |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 929 | */ |
Alan Chen | 9fcd4d3 | 2020-01-10 15:33:38 -0800 | [diff] [blame] | 930 | #if defined(WLAN_FEATURE_SAE) && defined(WLAN_FEATURE_11W) |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 931 | static enum mac_status_code lim_check_sae_pmf_cap(struct pe_session *session, |
Yu Ouyang | 228afe9 | 2019-08-12 18:01:56 +0800 | [diff] [blame] | 932 | tDot11fIERSN *rsn, |
| 933 | enum ani_akm_type akm_type) |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 934 | { |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 935 | enum mac_status_code status = eSIR_MAC_SUCCESS_STATUS; |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 936 | |
| 937 | if (session->pLimStartBssReq->pmfCapable && |
Yu Ouyang | 228afe9 | 2019-08-12 18:01:56 +0800 | [diff] [blame] | 938 | (rsn->RSN_Cap[0] & WLAN_CRYPTO_RSN_CAP_MFP_ENABLED) == 0 && |
| 939 | akm_type == ANI_AKM_TYPE_SAE) |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 940 | status = eSIR_MAC_ROBUST_MGMT_FRAMES_POLICY_VIOLATION_STATUS; |
| 941 | |
| 942 | return status; |
| 943 | } |
| 944 | #else |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 945 | static enum mac_status_code lim_check_sae_pmf_cap(struct pe_session *session, |
Yu Ouyang | 228afe9 | 2019-08-12 18:01:56 +0800 | [diff] [blame] | 946 | tDot11fIERSN *rsn, |
| 947 | enum ani_akm_type akm_type) |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 948 | { |
| 949 | return eSIR_MAC_SUCCESS_STATUS; |
| 950 | } |
| 951 | #endif |
| 952 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 953 | /** |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 954 | * lim_check_wpa_rsn_ie() - wpa and rsn ie related checks |
| 955 | * @session: pointer to pe session entry |
| 956 | * @mac_ctx: pointer to Global MAC structure |
| 957 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 958 | * @hdr: pointer to the MAC head |
| 959 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 960 | * @pmf_connection: flag indicating pmf connection |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 961 | * @akm_type: AKM type |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 962 | * |
| 963 | * This function checks if wpa/rsn IE is present and validates |
| 964 | * ie version, length and mismatch. |
| 965 | * |
| 966 | * Return: true if no error, false otherwise |
| 967 | */ |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 968 | static bool lim_check_wpa_rsn_ie(struct pe_session *session, |
| 969 | struct mac_context *mac_ctx, |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 970 | uint8_t sub_type, tpSirMacMgmtHdr hdr, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 971 | tpSirAssocReq assoc_req, bool *pmf_connection, |
| 972 | enum ani_akm_type *akm_type) |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 973 | { |
| 974 | uint32_t ret; |
| 975 | tDot11fIEWPA dot11f_ie_wpa = {0}; |
| 976 | tDot11fIERSN dot11f_ie_rsn = {0}; |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 977 | enum mac_status_code status = eSIR_MAC_SUCCESS_STATUS; |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 978 | |
| 979 | /* |
| 980 | * Clear the buffers so that frame parser knows that there isn't a |
| 981 | * previously decoded IE in these buffers |
| 982 | */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 983 | qdf_mem_zero((uint8_t *) &dot11f_ie_rsn, sizeof(dot11f_ie_rsn)); |
| 984 | qdf_mem_zero((uint8_t *) &dot11f_ie_wpa, sizeof(dot11f_ie_wpa)); |
Arun Kumar Khandavalli | 5ba2743 | 2020-01-20 11:47:44 +0530 | [diff] [blame] | 985 | pe_debug("RSN enabled auth, Re/Assoc req from STA: " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 986 | QDF_MAC_ADDR_FMT, QDF_MAC_ADDR_REF(hdr->sa)); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 987 | |
| 988 | if (assoc_req->rsnPresent) { |
| 989 | if (!(assoc_req->rsn.length)) { |
| 990 | pe_warn("Re/Assoc rejected from: " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 991 | QDF_MAC_ADDR_FMT, |
| 992 | QDF_MAC_ADDR_REF(hdr->sa)); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 993 | /* |
| 994 | * rcvd Assoc req frame with RSN IE but |
| 995 | * length is zero |
| 996 | */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 997 | lim_send_assoc_rsp_mgmt_frame( |
| 998 | mac_ctx, eSIR_MAC_INVALID_IE_STATUS, 1, |
| 999 | hdr->sa, sub_type, 0, session, false); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1000 | return false; |
| 1001 | } |
| 1002 | |
| 1003 | /* Unpack the RSN IE */ |
| 1004 | ret = dot11f_unpack_ie_rsn(mac_ctx, |
| 1005 | &assoc_req->rsn.info[0], |
| 1006 | assoc_req->rsn.length, |
| 1007 | &dot11f_ie_rsn, false); |
| 1008 | if (!DOT11F_SUCCEEDED(ret)) { |
| 1009 | pe_err("Invalid RSN IE"); |
Liangwei Dong | 433a8db | 2018-08-14 01:43:23 -0400 | [diff] [blame] | 1010 | lim_send_assoc_rsp_mgmt_frame( |
| 1011 | mac_ctx, eSIR_MAC_INVALID_IE_STATUS, 1, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1012 | hdr->sa, sub_type, 0, session, false); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1013 | return false; |
| 1014 | } |
| 1015 | |
| 1016 | /* Check if the RSN version is supported */ |
| 1017 | if (SIR_MAC_OUI_VERSION_1 == dot11f_ie_rsn.version) { |
| 1018 | /* check the groupwise and pairwise cipher suites */ |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 1019 | status = lim_check_rsn_ie(session, mac_ctx, assoc_req, |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 1020 | pmf_connection); |
| 1021 | if (eSIR_MAC_SUCCESS_STATUS != status) { |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1022 | pe_warn("Re/Assoc rejected from: " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1023 | QDF_MAC_ADDR_FMT, |
| 1024 | QDF_MAC_ADDR_REF(hdr->sa)); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1025 | |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1026 | lim_send_assoc_rsp_mgmt_frame( |
| 1027 | mac_ctx, status, 1, hdr->sa, sub_type, |
| 1028 | 0, session, false); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1029 | return false; |
| 1030 | } |
| 1031 | } else { |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1032 | pe_warn("Re/Assoc rejected from: " QDF_MAC_ADDR_FMT, |
| 1033 | QDF_MAC_ADDR_REF(hdr->sa)); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1034 | /* |
| 1035 | * rcvd Assoc req frame with RSN IE but |
| 1036 | * IE version is wrong |
| 1037 | */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1038 | lim_send_assoc_rsp_mgmt_frame( |
| 1039 | mac_ctx, |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1040 | eSIR_MAC_UNSUPPORTED_RSN_IE_VERSION_STATUS, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1041 | 1, hdr->sa, sub_type, 0, session, false); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1042 | return false; |
| 1043 | } |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1044 | *akm_type = lim_translate_rsn_oui_to_akm_type( |
| 1045 | dot11f_ie_rsn.akm_suite[0]); |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 1046 | |
Yu Ouyang | 228afe9 | 2019-08-12 18:01:56 +0800 | [diff] [blame] | 1047 | status = lim_check_sae_pmf_cap(session, &dot11f_ie_rsn, |
| 1048 | *akm_type); |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 1049 | if (eSIR_MAC_SUCCESS_STATUS != status) { |
| 1050 | /* Reject pmf disable SAE STA */ |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1051 | pe_warn("Re/Assoc rejected from: " QDF_MAC_ADDR_FMT, |
| 1052 | QDF_MAC_ADDR_REF(hdr->sa)); |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 1053 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, status, |
| 1054 | 1, hdr->sa, sub_type, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1055 | 0, session, false); |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 1056 | return false; |
| 1057 | } |
| 1058 | |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1059 | } else if (assoc_req->wpaPresent) { |
| 1060 | if (!(assoc_req->wpa.length)) { |
| 1061 | pe_warn("Re/Assoc rejected from: " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1062 | QDF_MAC_ADDR_FMT, |
| 1063 | QDF_MAC_ADDR_REF(hdr->sa)); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1064 | |
| 1065 | /* rcvd Assoc req frame with invalid WPA IE length */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1066 | lim_send_assoc_rsp_mgmt_frame( |
| 1067 | mac_ctx, eSIR_MAC_INVALID_IE_STATUS, 1, |
| 1068 | hdr->sa, sub_type, 0, session, false); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1069 | return false; |
| 1070 | } |
| 1071 | /* Unpack the WPA IE */ |
| 1072 | ret = dot11f_unpack_ie_wpa(mac_ctx, |
| 1073 | &assoc_req->wpa.info[4], |
| 1074 | (assoc_req->wpa.length - 4), |
| 1075 | &dot11f_ie_wpa, false); |
| 1076 | if (!DOT11F_SUCCEEDED(ret)) { |
| 1077 | pe_err("Invalid WPA IE"); |
Liangwei Dong | 433a8db | 2018-08-14 01:43:23 -0400 | [diff] [blame] | 1078 | lim_send_assoc_rsp_mgmt_frame( |
| 1079 | mac_ctx, eSIR_MAC_INVALID_IE_STATUS, 1, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1080 | hdr->sa, sub_type, 0, session, false); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1081 | return false; |
| 1082 | } |
| 1083 | |
| 1084 | /* check the groupwise and pairwise cipher suites*/ |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 1085 | status = lim_check_wpa_ie(session, mac_ctx, assoc_req, |
| 1086 | &dot11f_ie_wpa); |
| 1087 | if (eSIR_MAC_SUCCESS_STATUS != status) { |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1088 | pe_warn("Re/Assoc rejected from: " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1089 | QDF_MAC_ADDR_FMT, |
| 1090 | QDF_MAC_ADDR_REF(hdr->sa)); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1091 | /* |
| 1092 | * rcvd Assoc req frame with WPA IE |
| 1093 | * but there is mismatch |
| 1094 | */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1095 | lim_send_assoc_rsp_mgmt_frame( |
| 1096 | mac_ctx, status, 1, |
| 1097 | hdr->sa, sub_type, 0, session, false); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1098 | return false; |
| 1099 | } |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1100 | *akm_type = lim_translate_rsn_oui_to_akm_type( |
| 1101 | dot11f_ie_wpa.auth_suites[0]); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1102 | } |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1103 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 1104 | return true; |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1105 | } |
| 1106 | |
| 1107 | /** |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1108 | * lim_chk_n_process_wpa_rsn_ie() - wpa ie related checks |
| 1109 | * @mac_ctx: pointer to Global MAC structure |
| 1110 | * @hdr: pointer to the MAC head |
| 1111 | * @session: pointer to pe session entry |
| 1112 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 1113 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 1114 | * @pmf_connection: flag indicating pmf connection |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1115 | * @akm_type: AKM type |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1116 | * |
| 1117 | * wpa ie related checks |
| 1118 | * |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1119 | * Return: true if no error, false otherwise |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1120 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1121 | static bool lim_chk_n_process_wpa_rsn_ie(struct mac_context *mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1122 | tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 1123 | struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1124 | tpSirAssocReq assoc_req, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1125 | uint8_t sub_type, |
| 1126 | bool *pmf_connection, |
| 1127 | enum ani_akm_type *akm_type) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1128 | { |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 1129 | const uint8_t *wps_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1130 | |
| 1131 | /* if additional IE is present, check if it has WscIE */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1132 | if (assoc_req->addIEPresent && assoc_req->addIE.length) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1133 | wps_ie = limGetWscIEPtr(mac_ctx, assoc_req->addIE.addIEdata, |
| 1134 | assoc_req->addIE.length); |
| 1135 | else |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1136 | pe_debug("Assoc req addIEPresent: %d addIE length: %d", |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1137 | assoc_req->addIEPresent, assoc_req->addIE.length); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1138 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1139 | /* when wps_ie is present, RSN/WPA IE is ignored */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1140 | if (!wps_ie) { |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1141 | /* check whether RSN IE is present */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1142 | if (LIM_IS_AP_ROLE(session) && |
| 1143 | session->pLimStartBssReq->privacy && |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1144 | session->pLimStartBssReq->rsnIE.length) |
| 1145 | return lim_check_wpa_rsn_ie(session, mac_ctx, sub_type, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1146 | hdr, assoc_req, pmf_connection, |
| 1147 | akm_type); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1148 | } else { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1149 | pe_debug("Assoc req WSE IE is present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1150 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1151 | return true; |
| 1152 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1153 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1154 | /** |
| 1155 | * lim_process_assoc_req_no_sta_ctx() - process assoc req for no sta ctx present |
| 1156 | * @mac_ctx: pointer to Global MAC structure |
| 1157 | * @hdr: pointer to the MAC head |
| 1158 | * @session: pointer to pe session entry |
| 1159 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 1160 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 1161 | * @sta_pre_auth_ctx: sta pre auth context |
| 1162 | * @sta_ds: station dph entry |
| 1163 | * @auth_type: indicates security type |
| 1164 | * |
| 1165 | * Process assoc req for no sta ctx present |
| 1166 | * |
| 1167 | * Return: true of no error, false otherwise |
| 1168 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1169 | static bool lim_process_assoc_req_no_sta_ctx(struct mac_context *mac_ctx, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 1170 | tpSirMacMgmtHdr hdr, struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1171 | tpSirAssocReq assoc_req, uint8_t sub_type, |
| 1172 | struct tLimPreAuthNode *sta_pre_auth_ctx, |
| 1173 | tpDphHashNode sta_ds, tAniAuthType *auth_type) |
| 1174 | { |
| 1175 | /* Requesting STA is not currently associated */ |
| 1176 | if (pe_get_current_stas_count(mac_ctx) == |
Bala Venkatesh | 2fde2c6 | 2018-09-11 20:33:24 +0530 | [diff] [blame] | 1177 | mac_ctx->mlme_cfg->sap_cfg.assoc_sta_limit) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1178 | /* |
| 1179 | * Maximum number of STAs that AP can handle reached. |
| 1180 | * Send Association response to peer MAC entity |
| 1181 | */ |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1182 | pe_err("Max Sta count reached : %d", |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1183 | mac_ctx->lim.maxStation); |
| 1184 | lim_reject_association(mac_ctx, hdr->sa, sub_type, false, |
| 1185 | (tAniAuthType) 0, 0, false, |
Varun Reddy Yeturu | 725185d | 2017-11-17 14:14:55 -0800 | [diff] [blame] | 1186 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1187 | session); |
| 1188 | return false; |
| 1189 | } |
| 1190 | /* Check if STA is pre-authenticated. */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1191 | if ((!sta_pre_auth_ctx) || (sta_pre_auth_ctx && |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1192 | (sta_pre_auth_ctx->mlmState != eLIM_MLM_AUTHENTICATED_STATE))) { |
| 1193 | /* |
| 1194 | * STA is not pre-authenticated yet requesting Re/Association |
| 1195 | * before Authentication. OR STA is in the process of getting |
| 1196 | * authenticated and sent Re/Association request. Send |
| 1197 | * Deauthentication frame with 'prior authentication required' |
| 1198 | * reason code. |
| 1199 | */ |
| 1200 | lim_send_deauth_mgmt_frame(mac_ctx, |
| 1201 | eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, |
| 1202 | hdr->sa, session, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1203 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1204 | pe_warn("rcvd %s req, sessionid: %d, without pre-auth ctx" |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1205 | QDF_MAC_ADDR_FMT, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1206 | (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1207 | session->peSessionId, QDF_MAC_ADDR_REF(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1208 | return false; |
| 1209 | } |
| 1210 | /* Delete 'pre-auth' context of STA */ |
| 1211 | *auth_type = sta_pre_auth_ctx->authType; |
Srinivas Dasari | 5f52820 | 2019-02-11 17:29:43 +0530 | [diff] [blame] | 1212 | if (sta_pre_auth_ctx->authType == eSIR_AUTH_TYPE_SAE) |
| 1213 | assoc_req->is_sae_authenticated = true; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1214 | lim_delete_pre_auth_node(mac_ctx, hdr->sa); |
| 1215 | /* All is well. Assign AID (after else part) */ |
| 1216 | return true; |
| 1217 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1218 | |
Abhishek Singh | 7a7799b | 2020-01-21 10:30:28 +0530 | [diff] [blame] | 1219 | #ifdef WLAN_DEBUG |
| 1220 | static inline void |
| 1221 | lim_update_assoc_drop_count(struct mac_context *mac_ctx, uint8_t sub_type) |
| 1222 | { |
| 1223 | if (sub_type == LIM_ASSOC) |
| 1224 | mac_ctx->lim.gLimNumAssocReqDropInvldState++; |
| 1225 | else |
| 1226 | mac_ctx->lim.gLimNumReassocReqDropInvldState++; |
| 1227 | } |
| 1228 | #else |
| 1229 | static inline void |
| 1230 | lim_update_assoc_drop_count(struct mac_context *mac_ctx, uint8_t sub_type) {} |
| 1231 | #endif |
| 1232 | |
| 1233 | #ifdef WLAN_FEATURE_11W |
| 1234 | static inline void |
| 1235 | lim_delete_pmf_query_timer(tpDphHashNode sta_ds) |
| 1236 | { |
| 1237 | if (!sta_ds->rmfEnabled) |
| 1238 | return; |
| 1239 | |
| 1240 | if (tx_timer_running(&sta_ds->pmfSaQueryTimer)) |
| 1241 | tx_timer_deactivate(&sta_ds->pmfSaQueryTimer); |
| 1242 | tx_timer_delete(&sta_ds->pmfSaQueryTimer); |
| 1243 | } |
| 1244 | #else |
| 1245 | static inline void |
| 1246 | lim_delete_pmf_query_timer(tpDphHashNode sta_ds) {} |
| 1247 | #endif |
| 1248 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1249 | /** |
| 1250 | * lim_process_assoc_req_sta_ctx() - process assoc req for sta context present |
| 1251 | * @mac_ctx: pointer to Global MAC structure |
| 1252 | * @hdr: pointer to the MAC head |
| 1253 | * @session: pointer to pe session entry |
| 1254 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 1255 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 1256 | * @sta_pre_auth_ctx: sta pre auth context |
| 1257 | * @sta_ds: station dph entry |
| 1258 | * @peer_idx: peer index |
| 1259 | * @auth_type: indicates security type |
| 1260 | * @update_ctx: indicates if STA context already exist |
| 1261 | * |
| 1262 | * Process assoc req for sta context present |
| 1263 | * |
| 1264 | * Return: true of no error, false otherwise |
| 1265 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1266 | static bool lim_process_assoc_req_sta_ctx(struct mac_context *mac_ctx, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 1267 | tpSirMacMgmtHdr hdr, struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1268 | tpSirAssocReq assoc_req, uint8_t sub_type, |
| 1269 | struct tLimPreAuthNode *sta_pre_auth_ctx, |
| 1270 | tpDphHashNode sta_ds, uint16_t peer_idx, |
| 1271 | tAniAuthType *auth_type, uint8_t *update_ctx) |
| 1272 | { |
Abhishek Singh | 7a7799b | 2020-01-21 10:30:28 +0530 | [diff] [blame] | 1273 | /* Drop if STA deletion is in progress or not in established state */ |
| 1274 | if (sta_ds->sta_deletion_in_progress || |
| 1275 | (sta_ds->mlmStaContext.mlmState != |
| 1276 | eLIM_MLM_LINK_ESTABLISHED_STATE)) { |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1277 | pe_debug("%s: peer:"QDF_MAC_ADDR_FMT" in mlmState %d (%s) and sta del %d", |
Abhishek Singh | 7a7799b | 2020-01-21 10:30:28 +0530 | [diff] [blame] | 1278 | (sub_type == LIM_ASSOC) ? "Assoc" : "ReAssoc", |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1279 | QDF_MAC_ADDR_REF(sta_ds->staAddr), |
| 1280 | sta_ds->mlmStaContext.mlmState, |
Abhishek Singh | 7a7799b | 2020-01-21 10:30:28 +0530 | [diff] [blame] | 1281 | lim_mlm_state_str(sta_ds->mlmStaContext.mlmState), |
| 1282 | sta_ds->sta_deletion_in_progress); |
| 1283 | lim_update_assoc_drop_count(mac_ctx, sub_type); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1284 | return false; |
| 1285 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1286 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1287 | /* STA sent assoc req frame while already in 'associated' state */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1288 | |
| 1289 | #ifdef WLAN_FEATURE_11W |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1290 | pe_debug("Re/Assoc request from station that is already associated"); |
| 1291 | pe_debug("PMF enabled: %d, SA Query state: %d", |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1292 | sta_ds->rmfEnabled, sta_ds->pmfSaQueryState); |
| 1293 | if (sta_ds->rmfEnabled) { |
| 1294 | switch (sta_ds->pmfSaQueryState) { |
| 1295 | /* |
| 1296 | * start SA Query procedure, respond to Association Request with |
| 1297 | * try again later |
| 1298 | */ |
| 1299 | case DPH_SA_QUERY_NOT_IN_PROGRESS: |
| 1300 | /* |
| 1301 | * We should reset the retry counter before we start |
| 1302 | * the SA query procedure, otherwise in next set of SA |
| 1303 | * query procedure we will end up using the stale value. |
| 1304 | */ |
| 1305 | sta_ds->pmfSaQueryRetryCount = 0; |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1306 | lim_send_assoc_rsp_mgmt_frame( |
| 1307 | mac_ctx, eSIR_MAC_TRY_AGAIN_LATER, 1, hdr->sa, |
| 1308 | sub_type, sta_ds, session, false); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1309 | lim_send_sa_query_request_frame(mac_ctx, |
| 1310 | (uint8_t *) &(sta_ds->pmfSaQueryCurrentTransId), |
| 1311 | hdr->sa, session); |
| 1312 | sta_ds->pmfSaQueryStartTransId = |
| 1313 | sta_ds->pmfSaQueryCurrentTransId; |
| 1314 | sta_ds->pmfSaQueryCurrentTransId++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1315 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1316 | /* start timer for SA Query retry */ |
| 1317 | if (tx_timer_activate(&sta_ds->pmfSaQueryTimer) |
| 1318 | != TX_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1319 | pe_err("PMF SA Query timer start failed!"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1320 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1321 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1322 | sta_ds->pmfSaQueryState = DPH_SA_QUERY_IN_PROGRESS; |
| 1323 | return false; |
| 1324 | /* |
| 1325 | * SA Query procedure still going, respond to Association |
| 1326 | * Request with try again later |
| 1327 | */ |
| 1328 | case DPH_SA_QUERY_IN_PROGRESS: |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1329 | lim_send_assoc_rsp_mgmt_frame( |
| 1330 | mac_ctx, eSIR_MAC_TRY_AGAIN_LATER, 1, |
| 1331 | hdr->sa, sub_type, 0, session, false); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1332 | return false; |
| 1333 | |
| 1334 | /* |
| 1335 | * SA Query procedure timed out, accept Association |
| 1336 | * Request normally |
| 1337 | */ |
| 1338 | case DPH_SA_QUERY_TIMED_OUT: |
| 1339 | sta_ds->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS; |
| 1340 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1341 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1342 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1343 | #endif |
| 1344 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1345 | /* no change in the capability so drop the frame */ |
| 1346 | if ((sub_type == LIM_ASSOC) && |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 1347 | (!qdf_mem_cmp(&sta_ds->mlmStaContext.capabilityInfo, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1348 | &assoc_req->capabilityInfo, |
| 1349 | sizeof(tSirMacCapabilityInfo)))) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1350 | pe_err("Received Assoc req in state: %X STAid: %d", |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1351 | sta_ds->mlmStaContext.mlmState, peer_idx); |
| 1352 | return false; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1353 | } |
Abhishek Singh | 7a7799b | 2020-01-21 10:30:28 +0530 | [diff] [blame] | 1354 | |
| 1355 | /* |
| 1356 | * STA sent Re/association Request frame while already in |
| 1357 | * 'associated' state. Update STA capabilities and send |
| 1358 | * Association response frame with same AID |
| 1359 | */ |
| 1360 | pe_debug("Rcvd Assoc req from STA already connected"); |
| 1361 | sta_ds->mlmStaContext.capabilityInfo = |
| 1362 | assoc_req->capabilityInfo; |
| 1363 | if (sta_pre_auth_ctx && (sta_pre_auth_ctx->mlmState == |
| 1364 | eLIM_MLM_AUTHENTICATED_STATE)) { |
| 1365 | /* STA has triggered pre-auth again */ |
| 1366 | *auth_type = sta_pre_auth_ctx->authType; |
| 1367 | lim_delete_pre_auth_node(mac_ctx, hdr->sa); |
| 1368 | } else { |
| 1369 | *auth_type = sta_ds->mlmStaContext.authType; |
| 1370 | } |
| 1371 | |
| 1372 | *update_ctx = true; |
| 1373 | /* Free pmf query timer before resetting the sta_ds */ |
| 1374 | lim_delete_pmf_query_timer(sta_ds); |
| 1375 | if (dph_init_sta_state(mac_ctx, hdr->sa, peer_idx, |
| 1376 | &session->dph.dphHashTable) == NULL) { |
| 1377 | pe_err("could not Init STAid: %d", peer_idx); |
| 1378 | return false; |
| 1379 | } |
| 1380 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1381 | return true; |
| 1382 | } |
| 1383 | |
| 1384 | /** |
| 1385 | * lim_chk_wmm() - wmm related checks |
| 1386 | * @mac_ctx: pointer to Global MAC structure |
| 1387 | * @hdr: pointer to the MAC head |
| 1388 | * @session: pointer to pe session entry |
| 1389 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 1390 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 1391 | * @qos_mode: qos mode |
| 1392 | * |
| 1393 | * wmm related checks |
| 1394 | * |
| 1395 | * Return: true of no error, false otherwise |
| 1396 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1397 | static bool lim_chk_wmm(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 1398 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1399 | uint8_t sub_type, tHalBitVal qos_mode) |
| 1400 | { |
| 1401 | tHalBitVal wme_mode; |
Jeff Johnson | c742d8d | 2017-10-10 16:36:54 -0700 | [diff] [blame] | 1402 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1403 | limGetWmeMode(session, &wme_mode); |
| 1404 | if ((qos_mode == eHAL_SET) || (wme_mode == eHAL_SET)) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1405 | /* |
| 1406 | * for a qsta, check if the requested Traffic spec is admissible |
| 1407 | * for a non-qsta check if the sta can be admitted |
| 1408 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1409 | if (assoc_req->addtsPresent) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1410 | uint8_t tspecIdx = 0; |
Jeff Johnson | c742d8d | 2017-10-10 16:36:54 -0700 | [diff] [blame] | 1411 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1412 | if (lim_admit_control_add_ts(mac_ctx, hdr->sa, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1413 | &(assoc_req->addtsReq), |
| 1414 | &(assoc_req->qosCapability), |
| 1415 | 0, false, NULL, &tspecIdx, session) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1416 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1417 | pe_warn("AdmitControl: TSPEC rejected"); |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1418 | lim_send_assoc_rsp_mgmt_frame( |
| 1419 | mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1420 | eSIR_MAC_QAP_NO_BANDWIDTH_REASON, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1421 | 1, hdr->sa, sub_type, 0, session, |
| 1422 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1423 | #ifdef WLAN_DEBUG |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1424 | mac_ctx->lim.gLimNumAssocReqDropACRejectTS++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1425 | #endif |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1426 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1427 | } |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1428 | } else if (lim_admit_control_add_sta(mac_ctx, hdr->sa, false) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1429 | != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1430 | pe_warn("AdmitControl: Sta rejected"); |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 1431 | lim_send_assoc_rsp_mgmt_frame( |
| 1432 | mac_ctx, eSIR_MAC_QAP_NO_BANDWIDTH_REASON, 1, |
| 1433 | hdr->sa, sub_type, 0, session, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1434 | #ifdef WLAN_DEBUG |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1435 | mac_ctx->lim.gLimNumAssocReqDropACRejectSta++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1436 | #endif |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1437 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1438 | } |
| 1439 | /* else all ok */ |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1440 | pe_debug("AdmitControl: Sta OK!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1441 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1442 | return true; |
| 1443 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1444 | |
Liangwei Dong | 57ef9a3 | 2019-12-25 13:14:40 +0800 | [diff] [blame] | 1445 | static void lim_update_sta_ds_op_classes(tpSirAssocReq assoc_req, |
| 1446 | tpDphHashNode sta_ds) |
| 1447 | { |
| 1448 | qdf_mem_copy(&sta_ds->supp_operating_classes, |
| 1449 | &assoc_req->supp_operating_classes, |
| 1450 | sizeof(tDot11fIESuppOperatingClasses)); |
| 1451 | } |
| 1452 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1453 | /** |
| 1454 | * lim_update_sta_ds() - updates ds dph entry |
| 1455 | * @mac_ctx: pointer to Global MAC structure |
| 1456 | * @hdr: pointer to the MAC head |
| 1457 | * @session: pointer to pe session entry |
Abhishek Singh | 6108498 | 2016-12-13 17:24:07 +0530 | [diff] [blame] | 1458 | * @assoc_req: pointer to ASSOC/REASSOC Request frame pointer |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1459 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 1460 | * @sta_ds: station dph entry |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1461 | * @auth_type: indicates security type |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1462 | * @akm_type: indicates security type in akm |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1463 | * @assoc_req_copied: boolean to indicate if assoc req was copied to tmp above |
| 1464 | * @peer_idx: peer index |
| 1465 | * @qos_mode: qos mode |
| 1466 | * @pmf_connection: flag indicating pmf connection |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 1467 | * @force_1x1: Flag to check if the HT capable STA needs to be downgraded to 1x1 |
| 1468 | * nss. |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1469 | * |
| 1470 | * Updates ds dph entry |
| 1471 | * |
| 1472 | * Return: true of no error, false otherwise |
| 1473 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1474 | static bool lim_update_sta_ds(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1475 | struct pe_session *session, |
| 1476 | tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1477 | uint8_t sub_type, tpDphHashNode sta_ds, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1478 | tAniAuthType auth_type, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1479 | enum ani_akm_type akm_type, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1480 | bool *assoc_req_copied, uint16_t peer_idx, |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 1481 | tHalBitVal qos_mode, bool pmf_connection, |
| 1482 | bool force_1x1) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1483 | { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1484 | tHalBitVal wme_mode, wsm_mode; |
| 1485 | uint8_t *ht_cap_ie = NULL; |
| 1486 | #ifdef WLAN_FEATURE_11W |
| 1487 | tPmfSaQueryTimerId timer_id; |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 1488 | uint16_t retry_interval; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1489 | #endif |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1490 | tDot11fIEVHTCaps *vht_caps; |
Abhishek Singh | 6108498 | 2016-12-13 17:24:07 +0530 | [diff] [blame] | 1491 | tpSirAssocReq tmp_assoc_req; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1492 | |
| 1493 | if (assoc_req->VHTCaps.present) |
| 1494 | vht_caps = &assoc_req->VHTCaps; |
| 1495 | else if (assoc_req->vendor_vht_ie.VHTCaps.present && |
| 1496 | session->vendor_vht_sap) |
| 1497 | vht_caps = &assoc_req->vendor_vht_ie.VHTCaps; |
| 1498 | else |
| 1499 | vht_caps = NULL; |
| 1500 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1501 | /* |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1502 | * check here if the parsedAssocReq already pointing to the assoc_req |
| 1503 | * and free it before assigning this new assoc_req |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1504 | */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1505 | if (session->parsedAssocReq) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1506 | tmp_assoc_req = session->parsedAssocReq[sta_ds->assocId]; |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1507 | if (tmp_assoc_req) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1508 | if (tmp_assoc_req->assocReqFrame) { |
| 1509 | qdf_mem_free(tmp_assoc_req->assocReqFrame); |
| 1510 | tmp_assoc_req->assocReqFrame = NULL; |
| 1511 | tmp_assoc_req->assocReqFrameLength = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1512 | } |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1513 | qdf_mem_free(tmp_assoc_req); |
| 1514 | tmp_assoc_req = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1515 | } |
| 1516 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1517 | session->parsedAssocReq[sta_ds->assocId] = assoc_req; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1518 | *assoc_req_copied = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1519 | } |
| 1520 | |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1521 | if (!assoc_req->wmeInfoPresent) { |
| 1522 | sta_ds->mlmStaContext.htCapability = 0; |
| 1523 | sta_ds->mlmStaContext.vhtCapability = 0; |
| 1524 | } else { |
| 1525 | sta_ds->mlmStaContext.htCapability = assoc_req->HTCaps.present; |
| 1526 | if ((vht_caps) && vht_caps->present) |
| 1527 | sta_ds->mlmStaContext.vhtCapability = vht_caps->present; |
| 1528 | else |
| 1529 | sta_ds->mlmStaContext.vhtCapability = false; |
| 1530 | } |
| 1531 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1532 | lim_update_stads_he_capable(sta_ds, assoc_req); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1533 | sta_ds->qos.addtsPresent = |
| 1534 | (assoc_req->addtsPresent == 0) ? false : true; |
| 1535 | sta_ds->qos.addts = assoc_req->addtsReq; |
| 1536 | sta_ds->qos.capability = assoc_req->qosCapability; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1537 | /* |
| 1538 | * short slot and short preamble should be updated before doing |
| 1539 | * limaddsta |
| 1540 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1541 | sta_ds->shortPreambleEnabled = |
| 1542 | (uint8_t) assoc_req->capabilityInfo.shortPreamble; |
| 1543 | sta_ds->shortSlotTimeEnabled = |
| 1544 | (uint8_t) assoc_req->capabilityInfo.shortSlotTime; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1545 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1546 | sta_ds->valid = 0; |
| 1547 | sta_ds->mlmStaContext.authType = auth_type; |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1548 | sta_ds->mlmStaContext.akm_type = akm_type; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1549 | sta_ds->staType = STA_ENTRY_PEER; |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 1550 | sta_ds->mlmStaContext.force_1x1 = force_1x1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1551 | |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1552 | pe_debug("auth_type = %d, akm_type = %d", auth_type, akm_type); |
| 1553 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1554 | /* |
| 1555 | * TODO: If listen interval is more than certain limit, reject the |
| 1556 | * association. Need to check customer requirements and then implement. |
| 1557 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1558 | sta_ds->mlmStaContext.listenInterval = assoc_req->listenInterval; |
| 1559 | sta_ds->mlmStaContext.capabilityInfo = assoc_req->capabilityInfo; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1560 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1561 | if (IS_DOT11_MODE_HT(session->dot11mode) && |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1562 | sta_ds->mlmStaContext.htCapability) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1563 | sta_ds->htGreenfield = (uint8_t) assoc_req->HTCaps.greenField; |
| 1564 | sta_ds->htAMpduDensity = assoc_req->HTCaps.mpduDensity; |
| 1565 | sta_ds->htDsssCckRate40MHzSupport = |
| 1566 | (uint8_t) assoc_req->HTCaps.dsssCckMode40MHz; |
| 1567 | sta_ds->htLsigTXOPProtection = |
| 1568 | (uint8_t) assoc_req->HTCaps.lsigTXOPProtection; |
| 1569 | sta_ds->htMaxAmsduLength = |
| 1570 | (uint8_t) assoc_req->HTCaps.maximalAMSDUsize; |
| 1571 | sta_ds->htMaxRxAMpduFactor = assoc_req->HTCaps.maxRxAMPDUFactor; |
| 1572 | sta_ds->htMIMOPSState = assoc_req->HTCaps.mimoPowerSave; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1573 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1574 | /* assoc_req will be copied to session->parsedAssocReq later */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1575 | ht_cap_ie = ((uint8_t *) &assoc_req->HTCaps) + 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1576 | |
Jeff Johnson | be119e6 | 2019-02-02 12:30:26 -0800 | [diff] [blame] | 1577 | if (session->ht_config.ht_sgi20) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1578 | sta_ds->htShortGI20Mhz = |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1579 | (uint8_t)assoc_req->HTCaps.shortGI20MHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1580 | } else { |
| 1581 | /* Unset htShortGI20Mhz in ht_caps*/ |
| 1582 | *ht_cap_ie &= ~(1 << SIR_MAC_HT_CAP_SHORTGI20MHZ_S); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1583 | sta_ds->htShortGI20Mhz = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1584 | } |
| 1585 | |
Jeff Johnson | be119e6 | 2019-02-02 12:30:26 -0800 | [diff] [blame] | 1586 | if (session->ht_config.ht_sgi40) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1587 | sta_ds->htShortGI40Mhz = |
| 1588 | (uint8_t)assoc_req->HTCaps.shortGI40MHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1589 | } else { |
| 1590 | /* Unset htShortGI40Mhz in ht_caps */ |
| 1591 | *ht_cap_ie &= ~(1 << SIR_MAC_HT_CAP_SHORTGI40MHZ_S); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1592 | sta_ds->htShortGI40Mhz = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1593 | } |
| 1594 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1595 | sta_ds->htSupportedChannelWidthSet = |
| 1596 | (uint8_t) assoc_req->HTCaps.supportedChannelWidthSet; |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1597 | if (session->ch_width > CH_WIDTH_20MHZ && |
| 1598 | session->ch_width <= CH_WIDTH_80P80MHZ && |
| 1599 | sta_ds->htSupportedChannelWidthSet) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1600 | /* |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1601 | * peer just follows AP; so when we are softAP/GO, |
| 1602 | * we just store our session entry's secondary channel |
| 1603 | * offset here in peer INFRA STA. However, if peer's |
| 1604 | * 40MHz channel width support is disabled then |
| 1605 | * secondary channel will be zero |
Jeff Johnson | c742d8d | 2017-10-10 16:36:54 -0700 | [diff] [blame] | 1606 | */ |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1607 | sta_ds->htSecondaryChannelOffset = |
| 1608 | session->htSecondaryChannelOffset; |
| 1609 | sta_ds->ch_width = CH_WIDTH_40MHZ; |
| 1610 | if (sta_ds->mlmStaContext.vhtCapability) { |
| 1611 | if (assoc_req->operMode.present) { |
| 1612 | sta_ds->ch_width = |
| 1613 | assoc_req->operMode.chanWidth; |
| 1614 | } else if (vht_caps->supportedChannelWidthSet == |
| 1615 | VHT_CAP_160_AND_80P80_SUPP) { |
| 1616 | sta_ds->ch_width = CH_WIDTH_80P80MHZ; |
| 1617 | } else if (vht_caps->supportedChannelWidthSet == |
| 1618 | VHT_CAP_160_SUPP) { |
| 1619 | if (vht_caps->vht_extended_nss_bw_cap && |
| 1620 | vht_caps->extended_nss_bw_supp) |
| 1621 | sta_ds->ch_width = |
| 1622 | CH_WIDTH_80P80MHZ; |
| 1623 | else |
| 1624 | sta_ds->ch_width = |
| 1625 | CH_WIDTH_160MHZ; |
| 1626 | } else if (vht_caps->vht_extended_nss_bw_cap) { |
| 1627 | if (vht_caps->extended_nss_bw_supp == |
| 1628 | VHT_EXTD_NSS_80_HALF_NSS_160) |
| 1629 | sta_ds->ch_width = |
| 1630 | CH_WIDTH_160MHZ; |
| 1631 | else if (vht_caps->extended_nss_bw_supp > |
| 1632 | VHT_EXTD_NSS_80_HALF_NSS_160) |
| 1633 | sta_ds->ch_width = |
| 1634 | CH_WIDTH_80P80MHZ; |
| 1635 | else |
| 1636 | sta_ds->ch_width = |
| 1637 | CH_WIDTH_80MHZ; |
| 1638 | } else { |
| 1639 | sta_ds->ch_width = CH_WIDTH_80MHZ; |
| 1640 | } |
| 1641 | |
| 1642 | sta_ds->ch_width = QDF_MIN(sta_ds->ch_width, |
| 1643 | session->ch_width); |
| 1644 | } |
| 1645 | } else { |
| 1646 | sta_ds->htSupportedChannelWidthSet = 0; |
| 1647 | sta_ds->htSecondaryChannelOffset = 0; |
| 1648 | sta_ds->ch_width = CH_WIDTH_20MHZ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1649 | } |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1650 | sta_ds->htLdpcCapable = |
| 1651 | (uint8_t) assoc_req->HTCaps.advCodingCap; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1652 | } |
| 1653 | |
gaolez | 7bb1e74 | 2017-03-21 16:37:38 +0800 | [diff] [blame] | 1654 | if (assoc_req->ExtCap.present) |
| 1655 | sta_ds->non_ecsa_capable = |
| 1656 | !((struct s_ext_cap *)assoc_req->ExtCap.bytes)-> |
| 1657 | ext_chan_switch; |
| 1658 | else |
| 1659 | sta_ds->non_ecsa_capable = 1; |
| 1660 | |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1661 | if (sta_ds->mlmStaContext.vhtCapability && |
Abhinav Kumar | 2ae2524 | 2020-05-11 22:46:11 +0530 | [diff] [blame] | 1662 | session->vhtCapability) { |
hqu | ac3362d | 2019-11-08 17:54:21 +0800 | [diff] [blame] | 1663 | sta_ds->htMaxRxAMpduFactor = |
| 1664 | vht_caps->maxAMPDULenExp; |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1665 | sta_ds->vhtLdpcCapable = |
| 1666 | (uint8_t)vht_caps->ldpcCodingCap; |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 1667 | if (session->vht_config.su_beam_formee && |
Naveen Rawat | 2eb4c83 | 2018-02-15 10:47:38 -0800 | [diff] [blame] | 1668 | vht_caps->suBeamFormerCap) |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1669 | sta_ds->vhtBeamFormerCapable = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1670 | else |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1671 | sta_ds->vhtBeamFormerCapable = 0; |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 1672 | if (session->vht_config.su_beam_former && |
Naveen Rawat | 2eb4c83 | 2018-02-15 10:47:38 -0800 | [diff] [blame] | 1673 | vht_caps->suBeamformeeCap) |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1674 | sta_ds->vht_su_bfee_capable = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1675 | else |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1676 | sta_ds->vht_su_bfee_capable = 0; |
Naveen Rawat | 2eb4c83 | 2018-02-15 10:47:38 -0800 | [diff] [blame] | 1677 | |
| 1678 | pe_debug("peer_caps: suBformer: %d, suBformee: %d", |
| 1679 | vht_caps->suBeamFormerCap, |
| 1680 | vht_caps->suBeamformeeCap); |
| 1681 | pe_debug("self_cap: suBformer: %d, suBformee: %d", |
| 1682 | session->vht_config.su_beam_former, |
| 1683 | session->vht_config.su_beam_formee); |
| 1684 | pe_debug("connection's final cap: suBformer: %d, suBformee: %d", |
| 1685 | sta_ds->vhtBeamFormerCapable, |
| 1686 | sta_ds->vht_su_bfee_capable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1687 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1688 | |
Kiran Kumar Lokere | 89f01f0 | 2019-08-06 18:22:39 -0700 | [diff] [blame] | 1689 | sta_ds->vht_mcs_10_11_supp = 0; |
| 1690 | if (IS_DOT11_MODE_HT(session->dot11mode) && |
| 1691 | sta_ds->mlmStaContext.vhtCapability) { |
| 1692 | if (mac_ctx->mlme_cfg->vht_caps.vht_cap_info. |
| 1693 | vht_mcs_10_11_supp && |
| 1694 | assoc_req->qcn_ie.present && |
| 1695 | assoc_req->qcn_ie.vht_mcs11_attr.present) |
| 1696 | sta_ds->vht_mcs_10_11_supp = |
| 1697 | assoc_req->qcn_ie.vht_mcs11_attr. |
| 1698 | vht_mcs_10_11_supp; |
| 1699 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1700 | lim_intersect_sta_he_caps(assoc_req, session, sta_ds); |
| 1701 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1702 | if (lim_populate_matching_rate_set(mac_ctx, sta_ds, |
| 1703 | &(assoc_req->supportedRates), |
| 1704 | &(assoc_req->extendedRates), |
| 1705 | assoc_req->HTCaps.supportedMCSSet, |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 1706 | session, vht_caps, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1707 | &assoc_req->he_cap) != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1708 | /* Could not update hash table entry at DPH with rateset */ |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1709 | pe_err("Couldn't update hash entry for aid: %d MacAddr: " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1710 | QDF_MAC_ADDR_FMT, |
| 1711 | peer_idx, QDF_MAC_ADDR_REF(hdr->sa)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1712 | |
| 1713 | /* Release AID */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1714 | lim_release_peer_idx(mac_ctx, peer_idx, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1715 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1716 | lim_reject_association(mac_ctx, hdr->sa, |
Abhishek Singh | 0bc46d1 | 2017-01-09 13:05:54 +0530 | [diff] [blame] | 1717 | sub_type, true, auth_type, peer_idx, false, |
Varun Reddy Yeturu | 725185d | 2017-11-17 14:14:55 -0800 | [diff] [blame] | 1718 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1719 | session); |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1720 | pe_err("Delete dph hash entry"); |
Abhishek Singh | 0bc46d1 | 2017-01-09 13:05:54 +0530 | [diff] [blame] | 1721 | if (dph_delete_hash_entry(mac_ctx, hdr->sa, sta_ds->assocId, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1722 | &session->dph.dphHashTable) != QDF_STATUS_SUCCESS) |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1723 | pe_err("error deleting hash entry"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1724 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1725 | } |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1726 | if (assoc_req->operMode.present) { |
| 1727 | sta_ds->vhtSupportedRxNss = assoc_req->operMode.rxNSS + 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1728 | } else { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1729 | sta_ds->vhtSupportedRxNss = |
| 1730 | ((sta_ds->supportedRates.vhtRxMCSMap & MCSMAPMASK2x2) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1731 | == MCSMAPMASK2x2) ? 1 : 2; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1732 | } |
Liangwei Dong | 2b0c18b | 2019-12-10 13:29:53 +0800 | [diff] [blame] | 1733 | lim_update_stads_he_6ghz_op(session, sta_ds); |
Liangwei Dong | 57ef9a3 | 2019-12-25 13:14:40 +0800 | [diff] [blame] | 1734 | lim_update_sta_ds_op_classes(assoc_req, sta_ds); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1735 | /* Add STA context at MAC HW (BMU, RHP & TFP) */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1736 | sta_ds->qosMode = false; |
| 1737 | sta_ds->lleEnabled = false; |
| 1738 | if (assoc_req->capabilityInfo.qos && (qos_mode == eHAL_SET)) { |
| 1739 | sta_ds->lleEnabled = true; |
| 1740 | sta_ds->qosMode = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1741 | } |
| 1742 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1743 | sta_ds->wmeEnabled = false; |
| 1744 | sta_ds->wsmEnabled = false; |
| 1745 | limGetWmeMode(session, &wme_mode); |
| 1746 | if ((!sta_ds->lleEnabled) && assoc_req->wmeInfoPresent |
| 1747 | && (wme_mode == eHAL_SET)) { |
| 1748 | sta_ds->wmeEnabled = true; |
| 1749 | sta_ds->qosMode = true; |
| 1750 | limGetWsmMode(session, &wsm_mode); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1751 | /* |
| 1752 | * WMM_APSD - WMM_SA related processing should be separate; |
| 1753 | * WMM_SA and WMM_APSD can coexist |
| 1754 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1755 | if (assoc_req->WMMInfoStation.present) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1756 | /* check whether AP supports or not */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1757 | if (LIM_IS_AP_ROLE(session) && |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1758 | (session->apUapsdEnable == 0) && |
| 1759 | (assoc_req->WMMInfoStation.acbe_uapsd || |
| 1760 | assoc_req->WMMInfoStation.acbk_uapsd || |
| 1761 | assoc_req->WMMInfoStation.acvo_uapsd || |
| 1762 | assoc_req->WMMInfoStation.acvi_uapsd)) { |
| 1763 | /* |
| 1764 | * Rcvd Re/Assoc Req from STA when UPASD is |
| 1765 | * not supported. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1766 | */ |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1767 | pe_err("UAPSD not supported, reply accordingly"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1768 | /* update UAPSD and send it to LIM to add STA */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1769 | sta_ds->qos.capability.qosInfo.acbe_uapsd = 0; |
| 1770 | sta_ds->qos.capability.qosInfo.acbk_uapsd = 0; |
| 1771 | sta_ds->qos.capability.qosInfo.acvo_uapsd = 0; |
| 1772 | sta_ds->qos.capability.qosInfo.acvi_uapsd = 0; |
| 1773 | sta_ds->qos.capability.qosInfo.maxSpLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1774 | } else { |
| 1775 | /* update UAPSD and send it to LIM to add STA */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1776 | sta_ds->qos.capability.qosInfo.acbe_uapsd = |
| 1777 | assoc_req->WMMInfoStation.acbe_uapsd; |
| 1778 | sta_ds->qos.capability.qosInfo.acbk_uapsd = |
| 1779 | assoc_req->WMMInfoStation.acbk_uapsd; |
| 1780 | sta_ds->qos.capability.qosInfo.acvo_uapsd = |
| 1781 | assoc_req->WMMInfoStation.acvo_uapsd; |
| 1782 | sta_ds->qos.capability.qosInfo.acvi_uapsd = |
| 1783 | assoc_req->WMMInfoStation.acvi_uapsd; |
| 1784 | sta_ds->qos.capability.qosInfo.maxSpLen = |
| 1785 | assoc_req->WMMInfoStation.max_sp_length; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1786 | } |
| 1787 | } |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1788 | if (assoc_req->wsmCapablePresent && (wsm_mode == eHAL_SET)) |
| 1789 | sta_ds->wsmEnabled = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1790 | } |
| 1791 | /* Re/Assoc Response frame to requesting STA */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1792 | sta_ds->mlmStaContext.subType = sub_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1793 | |
| 1794 | #ifdef WLAN_FEATURE_11W |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1795 | sta_ds->rmfEnabled = (pmf_connection) ? 1 : 0; |
| 1796 | sta_ds->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS; |
| 1797 | timer_id.fields.sessionId = session->peSessionId; |
| 1798 | timer_id.fields.peerIdx = peer_idx; |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 1799 | retry_interval = mac_ctx->mlme_cfg->gen.pmf_sa_query_retry_interval; |
| 1800 | if (cfg_min(CFG_PMF_SA_QUERY_RETRY_INTERVAL) > retry_interval) { |
| 1801 | retry_interval = cfg_default(CFG_PMF_SA_QUERY_RETRY_INTERVAL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1802 | } |
Abhishek Singh | 7a7799b | 2020-01-21 10:30:28 +0530 | [diff] [blame] | 1803 | if (sta_ds->rmfEnabled) { |
| 1804 | /* Try to delete it before, creating.*/ |
| 1805 | lim_delete_pmf_query_timer(sta_ds); |
| 1806 | if (tx_timer_create(mac_ctx, &sta_ds->pmfSaQueryTimer, |
| 1807 | "PMF SA Query timer", lim_pmf_sa_query_timer_handler, |
| 1808 | timer_id.value, |
| 1809 | SYS_MS_TO_TICKS((retry_interval * 1024) / 1000), |
| 1810 | 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 1811 | pe_err("could not create PMF SA Query timer"); |
| 1812 | lim_reject_association(mac_ctx, hdr->sa, sub_type, |
| 1813 | true, auth_type, peer_idx, false, |
| 1814 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 1815 | session); |
| 1816 | return false; |
| 1817 | } |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1818 | pe_debug("Created pmf timer assoc-id:%d sta mac" QDF_MAC_ADDR_FMT, |
| 1819 | sta_ds->assocId, QDF_MAC_ADDR_REF(sta_ds->staAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1820 | } |
| 1821 | #endif |
| 1822 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1823 | if (assoc_req->ExtCap.present) { |
| 1824 | lim_set_stads_rtt_cap(sta_ds, |
| 1825 | (struct s_ext_cap *) assoc_req->ExtCap.bytes, mac_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1826 | } else { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1827 | sta_ds->timingMeasCap = 0; |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1828 | pe_debug("ExtCap not present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1829 | } |
Liangwei Dong | 0527617 | 2019-12-27 10:31:46 +0800 | [diff] [blame] | 1830 | lim_ap_check_6g_compatible_peer(mac_ctx, session); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1831 | return true; |
| 1832 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1833 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1834 | /** |
| 1835 | * lim_update_sta_ctx() - add/del sta depending on connection state machine |
| 1836 | * @mac_ctx: pointer to Global MAC structure |
| 1837 | * @session: pointer to pe session entry |
| 1838 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 1839 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 1840 | * @sta_ds: station dph entry |
| 1841 | * @update_ctx: indicates if STA context already exist |
| 1842 | * |
| 1843 | * Checks for SSID match |
| 1844 | * |
| 1845 | * Return: true of no error, false otherwise |
| 1846 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1847 | static bool lim_update_sta_ctx(struct mac_context *mac_ctx, struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1848 | tpSirAssocReq assoc_req, uint8_t sub_type, |
| 1849 | tpDphHashNode sta_ds, uint8_t update_ctx) |
| 1850 | { |
| 1851 | tLimMlmStates mlm_prev_state; |
| 1852 | /* |
| 1853 | * BTAMP: If STA context already exist (ie. update_ctx = 1) for this STA |
| 1854 | * then we should delete the old one, and add the new STA. This is taken |
| 1855 | * care of in the lim_del_sta() routine. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1856 | * |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1857 | * Prior to BTAMP, we were setting this flag so that when PE receives |
| 1858 | * SME_ASSOC_CNF, and if this flag is set, then PE shall delete the old |
| 1859 | * station and then add. But now in BTAMP, we're directly adding station |
| 1860 | * before waiting for SME_ASSOC_CNF, so we can do this now. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1861 | */ |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1862 | if (!(update_ctx)) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1863 | sta_ds->mlmStaContext.updateContext = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1864 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1865 | /* |
| 1866 | * BTAMP: Add STA context at HW - issue WMA_ADD_STA_REQ to HAL |
| 1867 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1868 | if (lim_add_sta(mac_ctx, sta_ds, false, session) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1869 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1870 | pe_err("could not Add STA with assocId: %d", |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1871 | sta_ds->assocId); |
| 1872 | lim_reject_association(mac_ctx, sta_ds->staAddr, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1873 | sta_ds->mlmStaContext.subType, true, |
| 1874 | sta_ds->mlmStaContext.authType, |
| 1875 | sta_ds->assocId, true, |
Varun Reddy Yeturu | 725185d | 2017-11-17 14:14:55 -0800 | [diff] [blame] | 1876 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1877 | session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1878 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1879 | if (session->parsedAssocReq) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1880 | assoc_req = |
| 1881 | session->parsedAssocReq[sta_ds->assocId]; |
| 1882 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1883 | } |
| 1884 | } else { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1885 | sta_ds->mlmStaContext.updateContext = 1; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1886 | mlm_prev_state = sta_ds->mlmStaContext.mlmState; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1887 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1888 | /* |
| 1889 | * As per the HAL/FW needs the reassoc req need not be calling |
| 1890 | * lim_del_sta |
| 1891 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1892 | if (sub_type != LIM_REASSOC) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1893 | /* |
| 1894 | * we need to set the mlmState here in order |
| 1895 | * differentiate in lim_del_sta. |
| 1896 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1897 | sta_ds->mlmStaContext.mlmState = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1898 | eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1899 | if (lim_del_sta(mac_ctx, sta_ds, true, session) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1900 | != QDF_STATUS_SUCCESS) { |
Yeshwanth Sriram Guntuka | e6b5424 | 2019-07-16 14:54:16 +0530 | [diff] [blame] | 1901 | pe_err("Couldn't DEL STA, assocId: %d sta mac" |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1902 | QDF_MAC_ADDR_FMT, sta_ds->assocId, |
| 1903 | QDF_MAC_ADDR_REF(sta_ds->staAddr)); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1904 | lim_reject_association(mac_ctx, sta_ds->staAddr, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1905 | sta_ds->mlmStaContext.subType, true, |
| 1906 | sta_ds->mlmStaContext.authType, |
| 1907 | sta_ds->assocId, true, |
Varun Reddy Yeturu | 725185d | 2017-11-17 14:14:55 -0800 | [diff] [blame] | 1908 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1909 | session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1910 | |
| 1911 | /* Restoring the state back. */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1912 | sta_ds->mlmStaContext.mlmState = mlm_prev_state; |
| 1913 | if (session->parsedAssocReq) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1914 | assoc_req = session->parsedAssocReq[ |
| 1915 | sta_ds->assocId]; |
| 1916 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1917 | } |
| 1918 | } else { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1919 | /* |
| 1920 | * mlmState is changed in lim_add_sta context use the |
| 1921 | * same AID, already allocated |
| 1922 | */ |
| 1923 | if (lim_add_sta(mac_ctx, sta_ds, false, session) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1924 | != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1925 | pe_err("UPASD not supported, REASSOC Failed"); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1926 | lim_reject_association(mac_ctx, sta_ds->staAddr, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1927 | sta_ds->mlmStaContext.subType, true, |
| 1928 | sta_ds->mlmStaContext.authType, |
| 1929 | sta_ds->assocId, true, |
Varun Reddy Yeturu | 725185d | 2017-11-17 14:14:55 -0800 | [diff] [blame] | 1930 | eSIR_MAC_WME_REFUSED_STATUS, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1931 | session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1932 | |
| 1933 | /* Restoring the state back. */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1934 | sta_ds->mlmStaContext.mlmState = mlm_prev_state; |
| 1935 | if (session->parsedAssocReq) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1936 | assoc_req = session->parsedAssocReq[ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1937 | sta_ds->assocId]; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1938 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1939 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1940 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1941 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1942 | return true; |
| 1943 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1944 | |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 1945 | void lim_process_assoc_cleanup(struct mac_context *mac_ctx, |
| 1946 | struct pe_session *session, |
| 1947 | tpSirAssocReq assoc_req, |
| 1948 | tpDphHashNode sta_ds, |
| 1949 | bool assoc_req_copied) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1950 | { |
Abhishek Singh | 6108498 | 2016-12-13 17:24:07 +0530 | [diff] [blame] | 1951 | tpSirAssocReq tmp_assoc_req; |
| 1952 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1953 | if (assoc_req) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1954 | if (assoc_req->assocReqFrame) { |
| 1955 | qdf_mem_free(assoc_req->assocReqFrame); |
| 1956 | assoc_req->assocReqFrame = NULL; |
| 1957 | assoc_req->assocReqFrameLength = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1958 | } |
| 1959 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1960 | qdf_mem_free(assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1961 | /* to avoid double free */ |
sheenam monga | d756ff1 | 2019-04-15 15:43:18 +0530 | [diff] [blame] | 1962 | if (assoc_req_copied && session->parsedAssocReq && sta_ds) |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1963 | session->parsedAssocReq[sta_ds->assocId] = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1964 | } |
| 1965 | |
| 1966 | /* If it is not duplicate Assoc request then only make to Null */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1967 | if ((sta_ds) && |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1968 | (sta_ds->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE)) { |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1969 | if (session->parsedAssocReq) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1970 | tmp_assoc_req = |
| 1971 | session->parsedAssocReq[sta_ds->assocId]; |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1972 | if (tmp_assoc_req) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1973 | if (tmp_assoc_req->assocReqFrame) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1974 | qdf_mem_free( |
| 1975 | tmp_assoc_req->assocReqFrame); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1976 | tmp_assoc_req->assocReqFrame = NULL; |
| 1977 | tmp_assoc_req->assocReqFrameLength = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1978 | } |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1979 | qdf_mem_free(tmp_assoc_req); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1980 | session->parsedAssocReq[sta_ds->assocId] = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1981 | } |
| 1982 | } |
| 1983 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1984 | } |
| 1985 | |
| 1986 | /** |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 1987 | * lim_defer_sme_indication() - Defer assoc indication to SME |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 1988 | * @mac_ctx: Pointer to Global MAC structure |
| 1989 | * @session: pe session entry |
| 1990 | * @sub_type: Indicates whether it is Association Request(=0) or Reassociation |
| 1991 | * Request(=1) frame |
| 1992 | * @hdr: A pointer to the MAC header |
| 1993 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 1994 | * @pmf_connection: flag indicating pmf connection |
| 1995 | * @assoc_req_copied: boolean to indicate if assoc req was copied to tmp above |
| 1996 | * @dup_entry: flag indicating if duplicate entry found |
| 1997 | * |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 1998 | * Defer Initialization of PE data structures and wait for an external event. |
| 1999 | * lim_send_assoc_ind_to_sme() will be called to initialize PE data structures |
| 2000 | * when the expected event is received. |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2001 | * |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 2002 | * Return: void |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2003 | */ |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 2004 | static void lim_defer_sme_indication(struct mac_context *mac_ctx, |
| 2005 | struct pe_session *session, |
| 2006 | uint8_t sub_type, |
| 2007 | tpSirMacMgmtHdr hdr, |
| 2008 | struct sSirAssocReq *assoc_req, |
| 2009 | bool pmf_connection, |
| 2010 | bool assoc_req_copied, |
| 2011 | bool dup_entry, |
| 2012 | struct sDphHashNode *sta_ds) |
| 2013 | { |
| 2014 | struct tLimPreAuthNode *sta_pre_auth_ctx; |
Srinivas Dasari | fffa0b4 | 2019-09-27 14:22:47 +0530 | [diff] [blame] | 2015 | struct lim_assoc_data *cached_req; |
| 2016 | |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 2017 | /* Extract pre-auth context for the STA, if any. */ |
| 2018 | sta_pre_auth_ctx = lim_search_pre_auth_list(mac_ctx, hdr->sa); |
Srinivas Dasari | fffa0b4 | 2019-09-27 14:22:47 +0530 | [diff] [blame] | 2019 | if (sta_pre_auth_ctx->assoc_req.present) { |
| 2020 | pe_debug("Free the cached assoc req as a new one is received"); |
| 2021 | cached_req = &sta_pre_auth_ctx->assoc_req; |
| 2022 | lim_process_assoc_cleanup(mac_ctx, session, |
| 2023 | cached_req->assoc_req, |
| 2024 | cached_req->sta_ds, |
| 2025 | cached_req->assoc_req_copied); |
| 2026 | } |
| 2027 | |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 2028 | sta_pre_auth_ctx->assoc_req.present = true; |
| 2029 | sta_pre_auth_ctx->assoc_req.sub_type = sub_type; |
| 2030 | qdf_mem_copy(&sta_pre_auth_ctx->assoc_req.hdr, hdr, |
| 2031 | sizeof(tSirMacMgmtHdr)); |
| 2032 | sta_pre_auth_ctx->assoc_req.assoc_req = assoc_req; |
| 2033 | sta_pre_auth_ctx->assoc_req.pmf_connection = pmf_connection; |
| 2034 | sta_pre_auth_ctx->assoc_req.assoc_req_copied = assoc_req_copied; |
| 2035 | sta_pre_auth_ctx->assoc_req.dup_entry = dup_entry; |
| 2036 | sta_pre_auth_ctx->assoc_req.sta_ds = sta_ds; |
| 2037 | } |
| 2038 | |
| 2039 | bool lim_send_assoc_ind_to_sme(struct mac_context *mac_ctx, |
| 2040 | struct pe_session *session, |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 2041 | uint8_t sub_type, tpSirMacMgmtHdr hdr, |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 2042 | tpSirAssocReq assoc_req, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 2043 | enum ani_akm_type akm_type, |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 2044 | bool pmf_connection, bool *assoc_req_copied, |
| 2045 | bool dup_entry, bool force_1x1) |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2046 | { |
| 2047 | uint16_t peer_idx; |
| 2048 | struct tLimPreAuthNode *sta_pre_auth_ctx; |
| 2049 | tpDphHashNode sta_ds = NULL; |
| 2050 | tHalBitVal qos_mode; |
| 2051 | tAniAuthType auth_type; |
| 2052 | uint8_t update_ctx = false; |
| 2053 | |
| 2054 | limGetQosMode(session, &qos_mode); |
| 2055 | /* Extract 'associated' context for STA, if any. */ |
| 2056 | sta_ds = dph_lookup_hash_entry(mac_ctx, hdr->sa, &peer_idx, |
| 2057 | &session->dph.dphHashTable); |
| 2058 | |
| 2059 | /* Extract pre-auth context for the STA, if any. */ |
| 2060 | sta_pre_auth_ctx = lim_search_pre_auth_list(mac_ctx, hdr->sa); |
| 2061 | |
| 2062 | if (!sta_ds) { |
| 2063 | if (!lim_process_assoc_req_no_sta_ctx(mac_ctx, hdr, session, |
| 2064 | assoc_req, sub_type, |
| 2065 | sta_pre_auth_ctx, sta_ds, |
| 2066 | &auth_type)) |
| 2067 | return false; |
| 2068 | } else { |
| 2069 | if (!lim_process_assoc_req_sta_ctx(mac_ctx, hdr, session, |
| 2070 | assoc_req, sub_type, |
| 2071 | sta_pre_auth_ctx, sta_ds, |
| 2072 | peer_idx, &auth_type, |
| 2073 | &update_ctx)) |
| 2074 | return false; |
| 2075 | goto send_ind_to_sme; |
| 2076 | } |
| 2077 | |
| 2078 | /* check if sta is allowed per QoS AC rules */ |
| 2079 | if (!lim_chk_wmm(mac_ctx, hdr, session, assoc_req, sub_type, qos_mode)) |
| 2080 | return false; |
| 2081 | |
| 2082 | /* STA is Associated ! */ |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2083 | pe_debug("Received: %s Req successful from " QDF_MAC_ADDR_FMT, |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2084 | (sub_type == LIM_ASSOC) ? "Assoc" : "ReAssoc", |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2085 | QDF_MAC_ADDR_REF(hdr->sa)); |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2086 | |
| 2087 | /* |
| 2088 | * AID for this association will be same as the peer Index used in DPH |
| 2089 | * table. Assign unused/least recently used peer Index from perStaDs. |
| 2090 | * NOTE: lim_assign_peer_idx() assigns AID values ranging between |
| 2091 | * 1 - cfg_item(WNI_CFG_ASSOC_STA_LIMIT) |
| 2092 | */ |
| 2093 | |
| 2094 | peer_idx = lim_assign_peer_idx(mac_ctx, session); |
| 2095 | |
| 2096 | if (!peer_idx) { |
| 2097 | /* Could not assign AID. Reject association */ |
| 2098 | pe_err("PeerIdx not avaialble. Reject associaton"); |
| 2099 | lim_reject_association(mac_ctx, hdr->sa, sub_type, |
| 2100 | true, auth_type, peer_idx, false, |
| 2101 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2102 | session); |
| 2103 | return false; |
| 2104 | } |
| 2105 | |
| 2106 | /* Add an entry to hash table maintained by DPH module */ |
| 2107 | |
| 2108 | sta_ds = dph_add_hash_entry(mac_ctx, hdr->sa, peer_idx, |
| 2109 | &session->dph.dphHashTable); |
| 2110 | |
| 2111 | if (!sta_ds) { |
| 2112 | /* Could not add hash table entry at DPH */ |
| 2113 | pe_err("couldn't add hash entry at DPH for aid: %d MacAddr:" |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2114 | QDF_MAC_ADDR_FMT, peer_idx, QDF_MAC_ADDR_REF(hdr->sa)); |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2115 | |
| 2116 | /* Release AID */ |
| 2117 | lim_release_peer_idx(mac_ctx, peer_idx, session); |
| 2118 | |
| 2119 | lim_reject_association(mac_ctx, hdr->sa, sub_type, |
| 2120 | true, auth_type, peer_idx, false, |
| 2121 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2122 | session); |
| 2123 | return false; |
| 2124 | } |
| 2125 | |
Rajasekaran Kalidoss | f4e187c | 2020-04-20 14:46:06 +0530 | [diff] [blame] | 2126 | if (LIM_IS_AP_ROLE(session)) { |
| 2127 | if ((assoc_req->wpaPresent || assoc_req->rsnPresent) && |
| 2128 | !session->privacy) { |
| 2129 | lim_reject_association(mac_ctx, hdr->sa, sub_type, |
| 2130 | true, auth_type, peer_idx, |
| 2131 | true, |
| 2132 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2133 | session); |
| 2134 | return false; |
| 2135 | } |
| 2136 | } |
| 2137 | |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2138 | send_ind_to_sme: |
| 2139 | if (!lim_update_sta_ds(mac_ctx, hdr, session, assoc_req, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 2140 | sub_type, sta_ds, auth_type, akm_type, |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2141 | assoc_req_copied, peer_idx, qos_mode, |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 2142 | pmf_connection, force_1x1)) |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2143 | return false; |
| 2144 | |
| 2145 | /* BTAMP: Storing the parsed assoc request in the session array */ |
| 2146 | if (session->parsedAssocReq) |
| 2147 | session->parsedAssocReq[sta_ds->assocId] = assoc_req; |
| 2148 | *assoc_req_copied = true; |
| 2149 | |
| 2150 | /* If it is duplicate entry wait till the peer is deleted */ |
| 2151 | if (!dup_entry) { |
| 2152 | if (!lim_update_sta_ctx(mac_ctx, session, assoc_req, |
| 2153 | sub_type, sta_ds, update_ctx)) |
| 2154 | return false; |
| 2155 | } |
| 2156 | |
| 2157 | /* AddSta is success here */ |
| 2158 | if (LIM_IS_AP_ROLE(session) && IS_DOT11_MODE_HT(session->dot11mode) && |
| 2159 | assoc_req->HTCaps.present && assoc_req->wmeInfoPresent) { |
| 2160 | /* |
| 2161 | * Update in the HAL Sta Table for the Update of the Protection |
| 2162 | * Mode |
| 2163 | */ |
Yeshwanth Sriram Guntuka | d2a2291 | 2019-07-16 15:44:52 +0530 | [diff] [blame] | 2164 | lim_post_sm_state_update(mac_ctx, |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2165 | sta_ds->htMIMOPSState, sta_ds->staAddr, |
| 2166 | session->smeSessionId); |
| 2167 | } |
| 2168 | |
| 2169 | return true; |
| 2170 | } |
| 2171 | |
| 2172 | /** |
Abhishek Singh | 594d033 | 2020-07-02 11:14:05 +0530 | [diff] [blame] | 2173 | * lim_peer_present_on_any_sta() - Check if Same MAC is connected with STA, i.e. |
| 2174 | * duplicate mac detection. |
| 2175 | * @mac_ctx: Pointer to Global MAC structure |
| 2176 | * @peer_addr: peer address to check |
| 2177 | * |
| 2178 | * This function will return true if a peer STA and AP are using same mac |
| 2179 | * address. |
| 2180 | * |
| 2181 | * @Return: bool |
| 2182 | */ |
| 2183 | static bool |
| 2184 | lim_peer_present_on_any_sta(struct mac_context *mac_ctx, uint8_t *peer_addr) |
| 2185 | { |
| 2186 | struct wlan_objmgr_peer *peer; |
| 2187 | bool sta_peer_present = false; |
| 2188 | enum QDF_OPMODE mode; |
| 2189 | uint8_t peer_vdev_id; |
| 2190 | |
| 2191 | peer = wlan_objmgr_get_peer_by_mac(mac_ctx->psoc, peer_addr, |
| 2192 | WLAN_LEGACY_MAC_ID); |
| 2193 | if (!peer) |
| 2194 | return sta_peer_present; |
| 2195 | |
| 2196 | peer_vdev_id = wlan_vdev_get_id(wlan_peer_get_vdev(peer)); |
| 2197 | mode = wlan_vdev_mlme_get_opmode(wlan_peer_get_vdev(peer)); |
| 2198 | if (mode == QDF_STA_MODE || mode == QDF_P2P_CLIENT_MODE) { |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2199 | pe_debug("duplicate mac detected!!! Peer " QDF_MAC_ADDR_FMT " present on STA vdev %d", |
| 2200 | QDF_MAC_ADDR_REF(peer_addr), peer_vdev_id); |
Abhishek Singh | 594d033 | 2020-07-02 11:14:05 +0530 | [diff] [blame] | 2201 | sta_peer_present = true; |
| 2202 | } |
| 2203 | |
| 2204 | wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_MAC_ID); |
| 2205 | |
| 2206 | return sta_peer_present; |
| 2207 | } |
| 2208 | |
| 2209 | /** |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2210 | * lim_process_assoc_req_frame() - Process RE/ASSOC Request frame. |
| 2211 | * @mac_ctx: Pointer to Global MAC structure |
| 2212 | * @rx_pkt_info: A pointer to Buffer descriptor + associated PDUs |
| 2213 | * @sub_type: Indicates whether it is Association Request(=0) or Reassociation |
| 2214 | * Request(=1) frame |
| 2215 | * @session: pe session entry |
| 2216 | * |
| 2217 | * This function is called to process RE/ASSOC Request frame. |
| 2218 | * |
| 2219 | * @Return: void |
| 2220 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2221 | void lim_process_assoc_req_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 2222 | uint8_t sub_type, struct pe_session *session) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2223 | { |
| 2224 | bool pmf_connection = false, assoc_req_copied = false; |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2225 | uint8_t *frm_body; |
| 2226 | uint16_t assoc_id = 0; |
Krishna Kumaar Natarajan | db582ec | 2016-03-08 17:37:04 -0800 | [diff] [blame] | 2227 | uint32_t frame_len; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2228 | uint32_t phy_mode; |
| 2229 | tHalBitVal qos_mode; |
| 2230 | tpSirMacMgmtHdr hdr; |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 2231 | struct tLimPreAuthNode *sta_pre_auth_ctx; |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 2232 | enum ani_akm_type akm_type = ANI_AKM_TYPE_NONE; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2233 | tSirMacCapabilityInfo local_cap; |
| 2234 | tpDphHashNode sta_ds = NULL; |
Abhishek Singh | 6108498 | 2016-12-13 17:24:07 +0530 | [diff] [blame] | 2235 | tpSirAssocReq assoc_req; |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 2236 | bool dup_entry = false, force_1x1 = false; |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 2237 | QDF_STATUS status; |
bings | 186fdd2 | 2019-07-30 10:05:08 +0800 | [diff] [blame] | 2238 | struct wlan_objmgr_vdev *vdev; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2239 | |
| 2240 | lim_get_phy_mode(mac_ctx, &phy_mode, session); |
| 2241 | |
| 2242 | limGetQosMode(session, &qos_mode); |
| 2243 | |
| 2244 | hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 2245 | frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 2246 | |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2247 | pe_nofl_debug("Assoc req RX: subtype %d vdev %d sys role %d lim state %d rssi %d from " QDF_MAC_ADDR_FMT, |
Abhishek Singh | 7880096 | 2020-02-17 14:40:57 +0530 | [diff] [blame] | 2248 | sub_type, session->vdev_id, GET_LIM_SYSTEM_ROLE(session), |
| 2249 | session->limMlmState, |
| 2250 | WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info), |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2251 | QDF_MAC_ADDR_REF(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2252 | |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 2253 | if (LIM_IS_STA_ROLE(session)) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2254 | pe_err("Rcvd unexpected ASSOC REQ, sessionid: %d sys sub_type: %d for role: %d from: " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2255 | QDF_MAC_ADDR_FMT, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2256 | session->peSessionId, sub_type, |
| 2257 | GET_LIM_SYSTEM_ROLE(session), |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2258 | QDF_MAC_ADDR_REF(hdr->sa)); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2259 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 2260 | WMA_GET_RX_MPDU_DATA(rx_pkt_info), |
| 2261 | frame_len); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2262 | return; |
| 2263 | } |
Liangwei Dong | 9028d75 | 2016-10-17 02:00:17 -0400 | [diff] [blame] | 2264 | if (session->limMlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2265 | pe_err("drop ASSOC REQ on sessionid: %d " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2266 | "role: %d from: "QDF_MAC_ADDR_FMT" in limMlmState: %d", |
Liangwei Dong | 9028d75 | 2016-10-17 02:00:17 -0400 | [diff] [blame] | 2267 | session->peSessionId, |
| 2268 | GET_LIM_SYSTEM_ROLE(session), |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2269 | QDF_MAC_ADDR_REF(hdr->sa), |
Liangwei Dong | 9028d75 | 2016-10-17 02:00:17 -0400 | [diff] [blame] | 2270 | eLIM_MLM_WT_DEL_BSS_RSP_STATE); |
| 2271 | return; |
| 2272 | } |
bings | 186fdd2 | 2019-07-30 10:05:08 +0800 | [diff] [blame] | 2273 | vdev = session->vdev; |
| 2274 | if (!vdev) { |
| 2275 | pe_err("vdev is NULL"); |
| 2276 | return; |
| 2277 | } |
| 2278 | |
sheenam monga | f1655e1 | 2020-05-21 18:33:30 +0530 | [diff] [blame] | 2279 | if (wlan_vdev_mlme_get_state(vdev) != WLAN_VDEV_S_UP) { |
bings | 186fdd2 | 2019-07-30 10:05:08 +0800 | [diff] [blame] | 2280 | pe_err("SAP is not up, drop ASSOC REQ on sessionid: %d", |
| 2281 | session->peSessionId); |
| 2282 | |
| 2283 | return; |
| 2284 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2285 | |
Abhishek Singh | 594d033 | 2020-07-02 11:14:05 +0530 | [diff] [blame] | 2286 | if (lim_peer_present_on_any_sta(mac_ctx, hdr->sa)) |
| 2287 | /* |
| 2288 | * This mean a AP and STA have same mac address and device STA |
| 2289 | * is already connected to the AP, and STA is now trying to |
| 2290 | * connect to device SAP. So ignore association. |
| 2291 | */ |
| 2292 | return; |
| 2293 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2294 | /* |
| 2295 | * If a STA is already present in DPH and it is initiating a Assoc |
| 2296 | * re-transmit, do not process it. This can happen when first Assoc Req |
| 2297 | * frame is received but ACK lost at STA side. The ACK for this dropped |
| 2298 | * Assoc Req frame should be sent by HW. Host simply does not process it |
| 2299 | * once the entry for the STA is already present in DPH. |
| 2300 | */ |
| 2301 | sta_ds = dph_lookup_hash_entry(mac_ctx, hdr->sa, &assoc_id, |
| 2302 | &session->dph.dphHashTable); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2303 | if (sta_ds) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2304 | if (hdr->fc.retry > 0) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2305 | pe_err("STA is initiating Assoc Req after ACK lost. Do not process sessionid: %d sys sub_type=%d for role=%d from: " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2306 | QDF_MAC_ADDR_FMT, session->peSessionId, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2307 | sub_type, GET_LIM_SYSTEM_ROLE(session), |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2308 | QDF_MAC_ADDR_REF(hdr->sa)); |
Abhishek Singh | a0b4dc1 | 2017-03-09 15:29:31 +0530 | [diff] [blame] | 2309 | return; |
Krunal Soni | 1718426 | 2017-06-07 16:42:38 -0700 | [diff] [blame] | 2310 | } else if (!sta_ds->rmfEnabled && (sub_type == LIM_REASSOC)) { |
| 2311 | /* |
| 2312 | * SAP should send reassoc response with reject code |
| 2313 | * to avoid IOT issues. as per the specification SAP |
| 2314 | * should do 4-way handshake after reassoc response and |
| 2315 | * some STA doesn't like 4way handshake after reassoc |
| 2316 | * where some STA does expect 4-way handshake. |
| 2317 | */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 2318 | lim_send_assoc_rsp_mgmt_frame( |
| 2319 | mac_ctx, eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS, |
| 2320 | sta_ds->assocId, sta_ds->staAddr, |
| 2321 | sub_type, sta_ds, session, false); |
Krunal Soni | 1718426 | 2017-06-07 16:42:38 -0700 | [diff] [blame] | 2322 | pe_err("Rejecting reassoc req from STA"); |
| 2323 | return; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2324 | } else if (!sta_ds->rmfEnabled) { |
| 2325 | /* |
| 2326 | * Do this only for non PMF case. |
| 2327 | * STA might have missed the assoc response, so it is |
| 2328 | * sending assoc request frame again. |
| 2329 | */ |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 2330 | lim_send_assoc_rsp_mgmt_frame( |
| 2331 | mac_ctx, QDF_STATUS_SUCCESS, |
| 2332 | sta_ds->assocId, sta_ds->staAddr, |
| 2333 | sub_type, |
| 2334 | sta_ds, session, false); |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2335 | pe_err("DUT already received an assoc request frame and STA is sending another assoc req.So, do not Process sessionid: %d sys sub_type: %d for role: %d from: " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2336 | QDF_MAC_ADDR_FMT, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2337 | session->peSessionId, sub_type, |
| 2338 | session->limSystemRole, |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2339 | QDF_MAC_ADDR_REF(hdr->sa)); |
Abhishek Singh | a0b4dc1 | 2017-03-09 15:29:31 +0530 | [diff] [blame] | 2340 | return; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2341 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2342 | } |
| 2343 | |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 2344 | status = lim_check_sta_in_pe_entries(mac_ctx, hdr, session->peSessionId, |
| 2345 | &dup_entry); |
| 2346 | if (QDF_IS_STATUS_ERROR(status)) { |
| 2347 | pe_err("Reject assoc as duplicate entry is present and is already being deleted, assoc will be accepted once deletion is completed"); |
| 2348 | /* |
| 2349 | * This mean that the duplicate entry is present on other vdev |
| 2350 | * and is already being deleted, so reject the assoc and lets |
| 2351 | * peer try again to connect, once peer is deleted from |
| 2352 | * other vdev. |
| 2353 | */ |
| 2354 | lim_send_assoc_rsp_mgmt_frame( |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 2355 | mac_ctx, |
| 2356 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2357 | 1, hdr->sa, |
| 2358 | sub_type, 0, session, false); |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 2359 | return; |
| 2360 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2361 | |
| 2362 | /* Get pointer to Re/Association Request frame body */ |
| 2363 | frm_body = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 2364 | |
Srinivas Girigowda | b971ba2 | 2019-03-04 15:56:28 -0800 | [diff] [blame] | 2365 | if (IEEE80211_IS_MULTICAST(hdr->sa)) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2366 | /* |
| 2367 | * Rcvd Re/Assoc Req frame from BC/MC address Log error and |
| 2368 | * ignore it |
| 2369 | */ |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2370 | pe_err("Rcvd: %s Req, sessionid: %d from a BC/MC address" |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2371 | QDF_MAC_ADDR_FMT, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2372 | (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2373 | session->peSessionId, QDF_MAC_ADDR_REF(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2374 | return; |
| 2375 | } |
| 2376 | |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2377 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 2378 | (uint8_t *) frm_body, frame_len); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2379 | |
| 2380 | if (false == lim_chk_sa_da(mac_ctx, hdr, session, sub_type)) |
| 2381 | return; |
| 2382 | |
| 2383 | if (false == lim_chk_tkip(mac_ctx, hdr, session, sub_type)) |
| 2384 | return; |
| 2385 | |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 2386 | /* check for the presence of vendor IE */ |
| 2387 | if ((session->access_policy_vendor_ie) && |
| 2388 | (session->access_policy == |
| 2389 | LIM_ACCESS_POLICY_RESPOND_IF_IE_IS_PRESENT)) { |
Abhinav Kumar | db3c6f5 | 2018-06-20 15:02:00 +0530 | [diff] [blame] | 2390 | if (frame_len <= LIM_ASSOC_REQ_IE_OFFSET) { |
| 2391 | pe_debug("Received action frame of invalid len %d", |
| 2392 | frame_len); |
| 2393 | return; |
| 2394 | } |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 2395 | if (!wlan_get_vendor_ie_ptr_from_oui( |
| 2396 | &session->access_policy_vendor_ie[2], |
| 2397 | 3, frm_body + LIM_ASSOC_REQ_IE_OFFSET, |
Yeshwanth Sriram Guntuka | 9dea24e | 2018-06-14 18:44:41 +0530 | [diff] [blame] | 2398 | frame_len - LIM_ASSOC_REQ_IE_OFFSET)) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2399 | pe_err("Vendor ie not present and access policy is %x, Rejected association", |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 2400 | session->access_policy); |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 2401 | lim_send_assoc_rsp_mgmt_frame( |
| 2402 | mac_ctx, eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2403 | 1, hdr->sa, sub_type, 0, session, false); |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 2404 | return; |
| 2405 | } |
| 2406 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2407 | /* Allocate memory for the Assoc Request frame */ |
| 2408 | assoc_req = qdf_mem_malloc(sizeof(*assoc_req)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2409 | if (!assoc_req) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2410 | return; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2411 | |
| 2412 | /* Parse Assoc Request frame */ |
| 2413 | if (false == lim_chk_assoc_req_parse_error(mac_ctx, hdr, session, |
| 2414 | assoc_req, sub_type, frm_body, frame_len)) |
| 2415 | goto error; |
| 2416 | |
| 2417 | assoc_req->assocReqFrame = qdf_mem_malloc(frame_len); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2418 | if (!assoc_req->assocReqFrame) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2419 | goto error; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2420 | |
| 2421 | qdf_mem_copy((uint8_t *) assoc_req->assocReqFrame, |
| 2422 | (uint8_t *) frm_body, frame_len); |
| 2423 | assoc_req->assocReqFrameLength = frame_len; |
| 2424 | |
| 2425 | if (false == lim_chk_capab(mac_ctx, hdr, session, assoc_req, |
| 2426 | sub_type, &local_cap)) |
| 2427 | goto error; |
| 2428 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2429 | if (false == lim_chk_ssid(mac_ctx, hdr, session, assoc_req, sub_type)) |
| 2430 | goto error; |
| 2431 | |
| 2432 | if (false == lim_chk_rates(mac_ctx, hdr, session, assoc_req, sub_type)) |
| 2433 | goto error; |
| 2434 | |
| 2435 | if (false == lim_chk_11g_only(mac_ctx, hdr, session, assoc_req, |
| 2436 | sub_type)) |
| 2437 | goto error; |
| 2438 | |
| 2439 | if (false == lim_chk_11n_only(mac_ctx, hdr, session, assoc_req, |
| 2440 | sub_type)) |
| 2441 | goto error; |
| 2442 | |
| 2443 | if (false == lim_chk_11ac_only(mac_ctx, hdr, session, assoc_req, |
| 2444 | sub_type)) |
| 2445 | goto error; |
| 2446 | |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 2447 | if (false == lim_chk_11ax_only(mac_ctx, hdr, session, assoc_req, |
| 2448 | sub_type)) |
| 2449 | goto error; |
| 2450 | |
| 2451 | if (false == lim_check_11ax_basic_mcs(mac_ctx, hdr, session, assoc_req, |
| 2452 | sub_type)) |
| 2453 | goto error; |
| 2454 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2455 | /* Spectrum Management (11h) specific checks */ |
| 2456 | lim_process_for_spectrum_mgmt(mac_ctx, hdr, session, |
| 2457 | assoc_req, sub_type, local_cap); |
| 2458 | |
| 2459 | if (false == lim_chk_mcs(mac_ctx, hdr, session, assoc_req, sub_type)) |
| 2460 | goto error; |
| 2461 | |
| 2462 | if (false == lim_chk_is_11b_sta_supported(mac_ctx, hdr, session, |
| 2463 | assoc_req, sub_type, phy_mode)) |
| 2464 | goto error; |
| 2465 | |
| 2466 | /* |
| 2467 | * Check for 802.11n HT caps compatibility; are HT Capabilities |
| 2468 | * turned on in lim? |
| 2469 | */ |
| 2470 | lim_print_ht_cap(mac_ctx, session, assoc_req); |
| 2471 | |
| 2472 | if (false == lim_chk_n_process_wpa_rsn_ie(mac_ctx, hdr, session, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 2473 | assoc_req, sub_type, |
| 2474 | &pmf_connection, |
| 2475 | &akm_type)) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2476 | goto error; |
| 2477 | |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 2478 | /* Extract pre-auth context for the STA, if any. */ |
| 2479 | sta_pre_auth_ctx = lim_search_pre_auth_list(mac_ctx, hdr->sa); |
| 2480 | |
| 2481 | /* SAE authentication is offloaded to hostapd. Hostapd sends |
| 2482 | * authentication status to driver after completing SAE |
| 2483 | * authentication (after sending out 4/4 SAE auth frame). |
| 2484 | * There is a possible race condition where driver gets |
| 2485 | * assoc request from SAE station before getting authentication |
| 2486 | * status from hostapd. Don't reject the association in such |
| 2487 | * cases and defer the processing of assoc request frame by caching |
| 2488 | * the frame and process it when the auth status is received. |
| 2489 | */ |
| 2490 | if (sta_pre_auth_ctx && |
| 2491 | sta_pre_auth_ctx->authType == eSIR_AUTH_TYPE_SAE && |
| 2492 | sta_pre_auth_ctx->mlmState == eLIM_MLM_WT_SAE_AUTH_STATE) { |
| 2493 | pe_debug("Received assoc request frame while SAE authentication is in progress; Defer association request handling till SAE auth status is received"); |
| 2494 | lim_defer_sme_indication(mac_ctx, session, sub_type, hdr, |
| 2495 | assoc_req, pmf_connection, |
| 2496 | assoc_req_copied, dup_entry, sta_ds); |
| 2497 | return; |
| 2498 | } |
| 2499 | |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 2500 | if (session->opmode == QDF_P2P_GO_MODE) { |
| 2501 | /* |
| 2502 | * WAR: In P2P GO mode, if the P2P client device |
| 2503 | * is only HT capable and not VHT capable, but the P2P |
| 2504 | * GO device is VHT capable and advertises 2x2 NSS with |
| 2505 | * HT capablity client device, which results in IOT |
| 2506 | * issues. |
| 2507 | * When GO is operating in DBS mode, GO beacons |
| 2508 | * advertise 2x2 capability but include OMN IE to |
| 2509 | * indicate current operating mode of 1x1. But here |
| 2510 | * peer device is only HT capable and will not |
| 2511 | * understand OMN IE. |
| 2512 | */ |
| 2513 | force_1x1 = wlan_p2p_check_oui_and_force_1x1( |
| 2514 | frm_body + LIM_ASSOC_REQ_IE_OFFSET, |
| 2515 | frame_len - LIM_ASSOC_REQ_IE_OFFSET); |
| 2516 | } |
| 2517 | |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2518 | /* Send assoc indication to SME */ |
| 2519 | if (!lim_send_assoc_ind_to_sme(mac_ctx, session, sub_type, hdr, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 2520 | assoc_req, akm_type, pmf_connection, |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame] | 2521 | &assoc_req_copied, dup_entry, force_1x1)) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2522 | goto error; |
| 2523 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2524 | return; |
| 2525 | |
| 2526 | error: |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2527 | lim_process_assoc_cleanup(mac_ctx, session, assoc_req, sta_ds, |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 2528 | assoc_req_copied); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2529 | return; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 2530 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2531 | |
| 2532 | #ifdef FEATURE_WLAN_WAPI |
| 2533 | /** |
| 2534 | * lim_fill_assoc_ind_wapi_info()- Updates WAPI data in assoc indication |
| 2535 | * @mac_ctx: Global Mac context |
| 2536 | * @assoc_req: pointer to association request |
| 2537 | * @assoc_ind: Pointer to association indication |
| 2538 | * @wpsie: WPS IE |
| 2539 | * |
| 2540 | * This function updates WAPI meta data in association indication message |
| 2541 | * sent to SME. |
| 2542 | * |
| 2543 | * Return: None |
| 2544 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2545 | static void lim_fill_assoc_ind_wapi_info(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2546 | tpSirAssocReq assoc_req, tpLimMlmAssocInd assoc_ind, |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 2547 | const uint8_t *wpsie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2548 | { |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2549 | if (assoc_req->wapiPresent && (!wpsie)) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2550 | pe_debug("Received WAPI IE length in Assoc Req is %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2551 | assoc_req->wapi.length); |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 2552 | assoc_ind->wapiIE.wapiIEdata[0] = WLAN_ELEMID_WAPI; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2553 | assoc_ind->wapiIE.wapiIEdata[1] = assoc_req->wapi.length; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2554 | qdf_mem_copy(&assoc_ind->wapiIE.wapiIEdata[2], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2555 | assoc_req->wapi.info, assoc_req->wapi.length); |
| 2556 | assoc_ind->wapiIE.length = |
| 2557 | 2 + assoc_req->wapi.length; |
| 2558 | } |
| 2559 | return; |
| 2560 | } |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 2561 | #else |
| 2562 | static void lim_fill_assoc_ind_wapi_info( |
| 2563 | struct mac_context *mac_ctx, |
| 2564 | tpSirAssocReq assoc_req, tpLimMlmAssocInd assoc_ind, |
| 2565 | const uint8_t *wpsie) |
| 2566 | { |
| 2567 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2568 | #endif |
| 2569 | |
| 2570 | /** |
| 2571 | * lim_fill_assoc_ind_vht_info() - Updates VHT information in assoc indication |
| 2572 | * @mac_ctx: Global Mac context |
| 2573 | * @assoc_req: pointer to association request |
| 2574 | * @session_entry: PE session entry |
| 2575 | * @assoc_ind: Pointer to association indication |
| 2576 | * |
| 2577 | * This function updates VHT information in association indication message |
| 2578 | * sent to SME. |
| 2579 | * |
| 2580 | * Return: None |
| 2581 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2582 | static void lim_fill_assoc_ind_vht_info(struct mac_context *mac_ctx, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 2583 | struct pe_session *session_entry, |
Naveen Rawat | 6186ff9 | 2015-10-12 14:33:53 -0700 | [diff] [blame] | 2584 | tpSirAssocReq assoc_req, |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 2585 | tpLimMlmAssocInd assoc_ind, |
| 2586 | tpDphHashNode sta_ds) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2587 | { |
| 2588 | uint8_t chan; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 2589 | uint8_t i; |
| 2590 | bool nw_type_11b = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2591 | |
Amruta Kulkarni | 453c4e2 | 2019-11-20 10:59:21 -0800 | [diff] [blame] | 2592 | if (session_entry->limRFBand == REG_BAND_2G) { |
Naveen Rawat | 6186ff9 | 2015-10-12 14:33:53 -0700 | [diff] [blame] | 2593 | if (session_entry->vhtCapability && assoc_req->VHTCaps.present) |
Krishna Kumaar Natarajan | 294da81 | 2016-04-28 14:39:30 -0700 | [diff] [blame] | 2594 | assoc_ind->chan_info.info = MODE_11AC_VHT20_2G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2595 | else if (session_entry->htCapability |
Naveen Rawat | 6186ff9 | 2015-10-12 14:33:53 -0700 | [diff] [blame] | 2596 | && assoc_req->HTCaps.present) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2597 | assoc_ind->chan_info.info = MODE_11NG_HT20; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 2598 | else { |
| 2599 | for (i = 0; i < SIR_NUM_11A_RATES; i++) { |
| 2600 | if (sirIsArate(sta_ds-> |
| 2601 | supportedRates.llaRates[i] |
| 2602 | & 0x7F)) { |
| 2603 | assoc_ind->chan_info.info = MODE_11G; |
| 2604 | nw_type_11b = false; |
| 2605 | break; |
| 2606 | } |
| 2607 | } |
| 2608 | if (nw_type_11b) |
| 2609 | assoc_ind->chan_info.info = MODE_11B; |
| 2610 | } |
Naveen Rawat | 6186ff9 | 2015-10-12 14:33:53 -0700 | [diff] [blame] | 2611 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2612 | } |
Naveen Rawat | 6186ff9 | 2015-10-12 14:33:53 -0700 | [diff] [blame] | 2613 | |
| 2614 | if (session_entry->vhtCapability && assoc_req->VHTCaps.present) { |
| 2615 | if ((session_entry->ch_width > CH_WIDTH_40MHZ) |
| 2616 | && assoc_req->HTCaps.supportedChannelWidthSet) { |
| 2617 | chan = session_entry->ch_center_freq_seg0; |
| 2618 | assoc_ind->chan_info.band_center_freq1 = |
| 2619 | cds_chan_to_freq(chan); |
| 2620 | assoc_ind->chan_info.info = MODE_11AC_VHT80; |
| 2621 | return; |
| 2622 | } |
| 2623 | |
| 2624 | if ((session_entry->ch_width == CH_WIDTH_40MHZ) |
| 2625 | && assoc_req->HTCaps.supportedChannelWidthSet) { |
| 2626 | assoc_ind->chan_info.info = MODE_11AC_VHT40; |
| 2627 | if (session_entry->htSecondaryChannelOffset == |
| 2628 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY) |
| 2629 | assoc_ind->chan_info.band_center_freq1 += 10; |
| 2630 | else |
| 2631 | assoc_ind->chan_info.band_center_freq1 -= 10; |
| 2632 | return; |
| 2633 | } |
| 2634 | |
| 2635 | assoc_ind->chan_info.info = MODE_11AC_VHT20; |
| 2636 | return; |
| 2637 | } |
| 2638 | |
| 2639 | if (session_entry->htCapability && assoc_req->HTCaps.present) { |
| 2640 | if ((session_entry->ch_width == CH_WIDTH_40MHZ) |
| 2641 | && assoc_req->HTCaps.supportedChannelWidthSet) { |
| 2642 | assoc_ind->chan_info.info = MODE_11NA_HT40; |
| 2643 | if (session_entry->htSecondaryChannelOffset == |
| 2644 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY) |
| 2645 | assoc_ind->chan_info.band_center_freq1 += 10; |
| 2646 | else |
| 2647 | assoc_ind->chan_info.band_center_freq1 -= 10; |
| 2648 | return; |
| 2649 | } |
| 2650 | |
| 2651 | assoc_ind->chan_info.info = MODE_11NA_HT20; |
| 2652 | return; |
| 2653 | } |
| 2654 | |
| 2655 | assoc_ind->chan_info.info = MODE_11A; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2656 | return; |
| 2657 | } |
| 2658 | |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 2659 | static uint8_t lim_get_max_rate_idx(tSirMacRateSet *rateset) |
| 2660 | { |
| 2661 | uint8_t maxidx; |
| 2662 | int i; |
| 2663 | |
| 2664 | maxidx = rateset->rate[0] & 0x7f; |
| 2665 | for (i = 1; i < rateset->numRates; i++) { |
| 2666 | if ((rateset->rate[i] & 0x7f) > maxidx) |
| 2667 | maxidx = rateset->rate[i] & 0x7f; |
| 2668 | } |
| 2669 | |
| 2670 | return maxidx; |
| 2671 | } |
| 2672 | |
| 2673 | static void fill_mlm_assoc_ind_vht(tpSirAssocReq assocreq, |
| 2674 | tpDphHashNode stads, |
| 2675 | tpLimMlmAssocInd assocind) |
| 2676 | { |
| 2677 | if (stads->mlmStaContext.vhtCapability) { |
| 2678 | /* ampdu */ |
| 2679 | assocind->ampdu = true; |
| 2680 | |
| 2681 | /* sgi */ |
| 2682 | if (assocreq->VHTCaps.shortGI80MHz || |
| 2683 | assocreq->VHTCaps.shortGI160and80plus80MHz) |
| 2684 | assocind->sgi_enable = true; |
| 2685 | |
| 2686 | /* stbc */ |
| 2687 | assocind->tx_stbc = assocreq->VHTCaps.txSTBC; |
| 2688 | assocind->rx_stbc = assocreq->VHTCaps.rxSTBC; |
| 2689 | |
| 2690 | /* ch width */ |
| 2691 | assocind->ch_width = stads->vhtSupportedChannelWidthSet ? |
| 2692 | eHT_CHANNEL_WIDTH_80MHZ : |
| 2693 | stads->htSupportedChannelWidthSet ? |
| 2694 | eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ; |
| 2695 | |
| 2696 | /* mode */ |
| 2697 | assocind->mode = SIR_SME_PHY_MODE_VHT; |
| 2698 | assocind->rx_mcs_map = assocreq->VHTCaps.rxMCSMap & 0xff; |
| 2699 | assocind->tx_mcs_map = assocreq->VHTCaps.txMCSMap & 0xff; |
| 2700 | } |
| 2701 | } |
| 2702 | |
Gururaj Pandurangi | b518d6d | 2020-04-08 17:17:06 -0700 | [diff] [blame] | 2703 | /** |
| 2704 | *lim_convert_channel_width_enum() - map between two channel width enums |
| 2705 | *@ch_width: channel width of enum type phy_ch_width |
| 2706 | * |
| 2707 | *Return: channel width of enum type tSirMacHTChannelWidth |
| 2708 | */ |
| 2709 | static tSirMacHTChannelWidth |
| 2710 | lim_convert_channel_width_enum(enum phy_ch_width ch_width) |
| 2711 | { |
| 2712 | switch (ch_width) { |
| 2713 | case CH_WIDTH_20MHZ: |
| 2714 | return eHT_CHANNEL_WIDTH_20MHZ; |
| 2715 | case CH_WIDTH_40MHZ: |
| 2716 | return eHT_CHANNEL_WIDTH_40MHZ; |
| 2717 | case CH_WIDTH_80MHZ: |
| 2718 | return eHT_CHANNEL_WIDTH_80MHZ; |
| 2719 | case CH_WIDTH_160MHZ: |
| 2720 | return eHT_CHANNEL_WIDTH_160MHZ; |
| 2721 | case CH_WIDTH_80P80MHZ: |
| 2722 | return eHT_CHANNEL_WIDTH_80P80MHZ; |
| 2723 | case CH_WIDTH_MAX: |
| 2724 | return eHT_MAX_CHANNEL_WIDTH; |
| 2725 | case CH_WIDTH_5MHZ: |
| 2726 | break; |
| 2727 | case CH_WIDTH_10MHZ: |
| 2728 | break; |
| 2729 | case CH_WIDTH_INVALID: |
| 2730 | break; |
| 2731 | } |
| 2732 | pe_debug("invalid enum: %d", ch_width); |
| 2733 | return eHT_CHANNEL_WIDTH_20MHZ; |
| 2734 | } |
| 2735 | |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 2736 | bool lim_fill_lim_assoc_ind_params( |
| 2737 | tpLimMlmAssocInd assoc_ind, |
| 2738 | struct mac_context *mac_ctx, |
| 2739 | tpDphHashNode sta_ds, |
| 2740 | struct pe_session *session_entry) |
| 2741 | { |
| 2742 | tpSirAssocReq assoc_req; |
| 2743 | uint16_t rsn_len; |
| 2744 | uint32_t phy_mode; |
| 2745 | const uint8_t *wpsie = NULL; |
| 2746 | uint8_t maxidx, i; |
| 2747 | bool wme_enable; |
| 2748 | |
| 2749 | if (!session_entry->parsedAssocReq) { |
| 2750 | pe_err(" Parsed Assoc req is NULL"); |
| 2751 | return false; |
| 2752 | } |
| 2753 | |
| 2754 | /* Get a copy of the already parsed Assoc Request */ |
| 2755 | assoc_req = |
| 2756 | (tpSirAssocReq)session_entry->parsedAssocReq[sta_ds->assocId]; |
| 2757 | |
| 2758 | if (!assoc_req) { |
| 2759 | pe_err("assoc req for assoc_id:%d is NULL", sta_ds->assocId); |
| 2760 | return false; |
| 2761 | } |
| 2762 | |
| 2763 | /* Get the phy_mode */ |
| 2764 | lim_get_phy_mode(mac_ctx, &phy_mode, session_entry); |
| 2765 | |
| 2766 | qdf_mem_copy((uint8_t *)assoc_ind->peerMacAddr, |
| 2767 | (uint8_t *)sta_ds->staAddr, sizeof(tSirMacAddr)); |
| 2768 | assoc_ind->aid = sta_ds->assocId; |
| 2769 | qdf_mem_copy((uint8_t *)&assoc_ind->ssId, |
| 2770 | (uint8_t *)&assoc_req->ssId, |
| 2771 | assoc_req->ssId.length + 1); |
| 2772 | assoc_ind->sessionId = session_entry->peSessionId; |
| 2773 | assoc_ind->authType = sta_ds->mlmStaContext.authType; |
| 2774 | assoc_ind->akm_type = sta_ds->mlmStaContext.akm_type; |
| 2775 | assoc_ind->capabilityInfo = assoc_req->capabilityInfo; |
| 2776 | |
| 2777 | /* Fill in RSN IE information */ |
| 2778 | assoc_ind->rsnIE.length = 0; |
| 2779 | /* if WPS IE is present, ignore RSN IE */ |
| 2780 | if (assoc_req->addIEPresent && assoc_req->addIE.length) { |
| 2781 | wpsie = limGetWscIEPtr( |
| 2782 | mac_ctx, |
| 2783 | assoc_req->addIE.addIEdata, |
| 2784 | assoc_req->addIE.length); |
| 2785 | } |
| 2786 | if (assoc_req->rsnPresent && !wpsie) { |
| 2787 | pe_debug("Assoc Req RSN IE len: %d", |
| 2788 | assoc_req->rsn.length); |
| 2789 | assoc_ind->rsnIE.length = 2 + assoc_req->rsn.length; |
| 2790 | assoc_ind->rsnIE.rsnIEdata[0] = WLAN_ELEMID_RSN; |
| 2791 | assoc_ind->rsnIE.rsnIEdata[1] = |
| 2792 | assoc_req->rsn.length; |
| 2793 | qdf_mem_copy( |
| 2794 | &assoc_ind->rsnIE.rsnIEdata[2], |
| 2795 | assoc_req->rsn.info, |
| 2796 | assoc_req->rsn.length); |
| 2797 | } |
| 2798 | /* Fill in 802.11h related info */ |
| 2799 | if (assoc_req->powerCapabilityPresent && |
| 2800 | assoc_req->supportedChannelsPresent) { |
| 2801 | assoc_ind->spectrumMgtIndicator = true; |
| 2802 | assoc_ind->powerCap.minTxPower = |
| 2803 | assoc_req->powerCapability.minTxPower; |
| 2804 | assoc_ind->powerCap.maxTxPower = |
| 2805 | assoc_req->powerCapability.maxTxPower; |
| 2806 | lim_convert_supported_channels( |
| 2807 | mac_ctx, assoc_ind, |
| 2808 | assoc_req); |
| 2809 | } else { |
| 2810 | assoc_ind->spectrumMgtIndicator = false; |
| 2811 | } |
| 2812 | |
| 2813 | /* This check is to avoid extra Sec IEs present incase of WPS */ |
| 2814 | if (assoc_req->wpaPresent && !wpsie) { |
| 2815 | rsn_len = assoc_ind->rsnIE.length; |
| 2816 | if ((rsn_len + assoc_req->wpa.length) |
| 2817 | >= WLAN_MAX_IE_LEN) { |
| 2818 | pe_err("rsnIEdata index out of bounds: %d", |
| 2819 | rsn_len); |
| 2820 | return false; |
| 2821 | } |
| 2822 | assoc_ind->rsnIE.rsnIEdata[rsn_len] = |
| 2823 | SIR_MAC_WPA_EID; |
| 2824 | assoc_ind->rsnIE.rsnIEdata[rsn_len + 1] |
| 2825 | = assoc_req->wpa.length; |
| 2826 | qdf_mem_copy( |
| 2827 | &assoc_ind->rsnIE.rsnIEdata[rsn_len + 2], |
| 2828 | assoc_req->wpa.info, assoc_req->wpa.length); |
| 2829 | assoc_ind->rsnIE.length += 2 + assoc_req->wpa.length; |
| 2830 | } |
| 2831 | lim_fill_assoc_ind_wapi_info(mac_ctx, assoc_req, assoc_ind, wpsie); |
| 2832 | |
| 2833 | assoc_ind->addIE.length = 0; |
| 2834 | if (assoc_req->addIEPresent) { |
| 2835 | qdf_mem_copy( |
| 2836 | &assoc_ind->addIE.addIEdata, |
| 2837 | assoc_req->addIE.addIEdata, |
| 2838 | assoc_req->addIE.length); |
| 2839 | assoc_ind->addIE.length = assoc_req->addIE.length; |
| 2840 | } |
| 2841 | /* |
| 2842 | * Add HT Capabilities into addIE for OBSS |
| 2843 | * processing in hostapd |
| 2844 | */ |
| 2845 | if (assoc_req->HTCaps.present) { |
| 2846 | qdf_mem_copy(&assoc_ind->ht_caps, &assoc_req->HTCaps, |
| 2847 | sizeof(tDot11fIEHTCaps)); |
| 2848 | rsn_len = assoc_ind->addIE.length; |
| 2849 | if (assoc_ind->addIE.length + DOT11F_IE_HTCAPS_MIN_LEN |
| 2850 | + 2 < WLAN_MAX_IE_LEN) { |
| 2851 | assoc_ind->addIE.addIEdata[rsn_len] = |
| 2852 | WLAN_ELEMID_HTCAP_ANA; |
| 2853 | assoc_ind->addIE.addIEdata[rsn_len + 1] = |
| 2854 | DOT11F_IE_HTCAPS_MIN_LEN; |
| 2855 | qdf_mem_copy( |
| 2856 | &assoc_ind->addIE.addIEdata[rsn_len + 2], |
| 2857 | ((uint8_t *)&assoc_req->HTCaps) + 1, |
| 2858 | DOT11F_IE_HTCAPS_MIN_LEN); |
| 2859 | assoc_ind->addIE.length += |
| 2860 | 2 + DOT11F_IE_HTCAPS_MIN_LEN; |
| 2861 | } else { |
| 2862 | pe_err("Fail:HT capabilities IE to addIE"); |
| 2863 | } |
| 2864 | } |
| 2865 | |
| 2866 | if (assoc_req->wmeInfoPresent) { |
| 2867 | /* Set whether AP is enabled with WMM or not */ |
| 2868 | wme_enable = mac_ctx->mlme_cfg->wmm_params.wme_enabled; |
| 2869 | assoc_ind->WmmStaInfoPresent = wme_enable; |
| 2870 | /* |
| 2871 | * Note: we are not rejecting association here |
| 2872 | * because IOT will fail |
| 2873 | */ |
| 2874 | } |
| 2875 | /* Required for indicating the frames to upper layer */ |
| 2876 | assoc_ind->assocReqLength = assoc_req->assocReqFrameLength; |
| 2877 | assoc_ind->assocReqPtr = assoc_req->assocReqFrame; |
| 2878 | assoc_ind->beaconPtr = session_entry->beacon; |
| 2879 | assoc_ind->beaconLength = session_entry->bcnLen; |
| 2880 | |
| 2881 | assoc_ind->chan_info.mhz = session_entry->curr_op_freq; |
| 2882 | assoc_ind->chan_info.band_center_freq1 = |
| 2883 | session_entry->curr_op_freq; |
| 2884 | assoc_ind->chan_info.band_center_freq2 = 0; |
| 2885 | assoc_ind->chan_info.reg_info_1 = |
| 2886 | (session_entry->maxTxPower << 16); |
| 2887 | assoc_ind->chan_info.reg_info_2 = |
| 2888 | (session_entry->maxTxPower << 8); |
| 2889 | assoc_ind->chan_info.nss = sta_ds->nss; |
| 2890 | assoc_ind->chan_info.rate_flags = |
| 2891 | lim_get_max_rate_flags(mac_ctx, sta_ds); |
| 2892 | assoc_ind->ampdu = false; |
| 2893 | assoc_ind->sgi_enable = false; |
| 2894 | assoc_ind->tx_stbc = false; |
| 2895 | assoc_ind->rx_stbc = false; |
| 2896 | assoc_ind->ch_width = eHT_CHANNEL_WIDTH_20MHZ; |
| 2897 | assoc_ind->mode = SIR_SME_PHY_MODE_LEGACY; |
| 2898 | assoc_ind->max_supp_idx = 0xff; |
| 2899 | assoc_ind->max_ext_idx = 0xff; |
| 2900 | assoc_ind->max_mcs_idx = 0xff; |
| 2901 | assoc_ind->rx_mcs_map = 0xff; |
| 2902 | assoc_ind->tx_mcs_map = 0xff; |
| 2903 | |
| 2904 | if (assoc_req->supportedRates.numRates) |
| 2905 | assoc_ind->max_supp_idx = |
| 2906 | lim_get_max_rate_idx(&assoc_req->supportedRates); |
| 2907 | if (assoc_req->extendedRates.numRates) |
| 2908 | assoc_ind->max_ext_idx = |
| 2909 | lim_get_max_rate_idx(&assoc_req->extendedRates); |
| 2910 | |
| 2911 | if (sta_ds->mlmStaContext.htCapability) { |
| 2912 | /* ampdu */ |
| 2913 | assoc_ind->ampdu = true; |
| 2914 | |
| 2915 | /* sgi */ |
| 2916 | if (sta_ds->htShortGI20Mhz || sta_ds->htShortGI40Mhz) |
| 2917 | assoc_ind->sgi_enable = true; |
| 2918 | |
| 2919 | /* stbc */ |
| 2920 | assoc_ind->tx_stbc = assoc_req->HTCaps.txSTBC; |
| 2921 | assoc_ind->rx_stbc = assoc_req->HTCaps.rxSTBC; |
| 2922 | |
| 2923 | /* ch width */ |
| 2924 | assoc_ind->ch_width = |
| 2925 | sta_ds->htSupportedChannelWidthSet ? |
| 2926 | eHT_CHANNEL_WIDTH_40MHZ : |
| 2927 | eHT_CHANNEL_WIDTH_20MHZ; |
| 2928 | /* mode */ |
| 2929 | assoc_ind->mode = SIR_SME_PHY_MODE_HT; |
| 2930 | maxidx = 0; |
| 2931 | for (i = 0; i < 8; i++) { |
| 2932 | if (assoc_req->HTCaps.supportedMCSSet[0] & |
| 2933 | (1 << i)) |
| 2934 | maxidx = i; |
| 2935 | } |
| 2936 | assoc_ind->max_mcs_idx = maxidx; |
| 2937 | } |
| 2938 | fill_mlm_assoc_ind_vht(assoc_req, sta_ds, assoc_ind); |
| 2939 | if (assoc_req->ExtCap.present) |
| 2940 | assoc_ind->ecsa_capable = |
| 2941 | ((struct s_ext_cap *)assoc_req->ExtCap.bytes)->ext_chan_switch; |
| 2942 | /* updates VHT information in assoc indication */ |
Ashish Kumar Dhanotiya | 50a104b | 2020-03-05 21:25:09 +0530 | [diff] [blame] | 2943 | if (assoc_req->VHTCaps.present) |
| 2944 | qdf_mem_copy(&assoc_ind->vht_caps, &assoc_req->VHTCaps, |
| 2945 | sizeof(tDot11fIEVHTCaps)); |
| 2946 | else if (assoc_req->vendor_vht_ie.VHTCaps.present) |
| 2947 | qdf_mem_copy(&assoc_ind->vht_caps, |
| 2948 | &assoc_req->vendor_vht_ie.VHTCaps, |
| 2949 | sizeof(tDot11fIEVHTCaps)); |
| 2950 | |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 2951 | lim_fill_assoc_ind_vht_info(mac_ctx, session_entry, assoc_req, |
| 2952 | assoc_ind, sta_ds); |
| 2953 | assoc_ind->he_caps_present = assoc_req->he_cap.present; |
| 2954 | assoc_ind->is_sae_authenticated = |
| 2955 | assoc_req->is_sae_authenticated; |
Gururaj Pandurangi | b518d6d | 2020-04-08 17:17:06 -0700 | [diff] [blame] | 2956 | /* updates HE bandwidth in assoc indication */ |
| 2957 | if (wlan_reg_is_6ghz_chan_freq(session_entry->curr_op_freq)) |
| 2958 | assoc_ind->ch_width = |
| 2959 | lim_convert_channel_width_enum(sta_ds->ch_width); |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 2960 | return true; |
| 2961 | } |
| 2962 | |
Gu xiaocong | 6dbe3ba | 2021-07-06 13:20:58 +0800 | [diff] [blame^] | 2963 | void lim_send_mlm_assoc_ind(struct mac_context *mac_ctx, |
Srinivas Dasari | 6e9b813 | 2020-12-16 16:57:12 +0530 | [diff] [blame] | 2964 | tpDphHashNode sta_ds, |
| 2965 | struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2966 | { |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 2967 | tpLimMlmAssocInd assoc_ind; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2968 | tpSirAssocReq assoc_req; |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 2969 | uint16_t temp; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2970 | uint32_t phy_mode; |
| 2971 | uint8_t sub_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2972 | |
Pragaspathi Thilagaraj | aba1b5d | 2018-11-13 14:29:44 +0530 | [diff] [blame] | 2973 | if (!session_entry->parsedAssocReq) { |
| 2974 | pe_err(" Parsed Assoc req is NULL"); |
Gu xiaocong | 6dbe3ba | 2021-07-06 13:20:58 +0800 | [diff] [blame^] | 2975 | return; |
Pragaspathi Thilagaraj | aba1b5d | 2018-11-13 14:29:44 +0530 | [diff] [blame] | 2976 | } |
| 2977 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2978 | /* Get a copy of the already parsed Assoc Request */ |
| 2979 | assoc_req = |
| 2980 | (tpSirAssocReq) session_entry->parsedAssocReq[sta_ds->assocId]; |
| 2981 | |
Pragaspathi Thilagaraj | aba1b5d | 2018-11-13 14:29:44 +0530 | [diff] [blame] | 2982 | if (!assoc_req) { |
| 2983 | pe_err("assoc req for assoc_id:%d is NULL", sta_ds->assocId); |
Gu xiaocong | 6dbe3ba | 2021-07-06 13:20:58 +0800 | [diff] [blame^] | 2984 | return; |
Pragaspathi Thilagaraj | aba1b5d | 2018-11-13 14:29:44 +0530 | [diff] [blame] | 2985 | } |
| 2986 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2987 | /* Get the phy_mode */ |
| 2988 | lim_get_phy_mode(mac_ctx, &phy_mode, session_entry); |
| 2989 | |
| 2990 | /* Determine if its Assoc or ReAssoc Request */ |
| 2991 | if (assoc_req->reassocRequest == 1) |
| 2992 | sub_type = LIM_REASSOC; |
| 2993 | else |
| 2994 | sub_type = LIM_ASSOC; |
| 2995 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2996 | pe_debug("Sessionid: %d ssid: %s sub_type: %d Associd: %d staAddr: " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2997 | QDF_MAC_ADDR_FMT, session_entry->peSessionId, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 2998 | assoc_req->ssId.ssId, sub_type, sta_ds->assocId, |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2999 | QDF_MAC_ADDR_REF(sta_ds->staAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3000 | |
| 3001 | if (sub_type == LIM_ASSOC || sub_type == LIM_REASSOC) { |
| 3002 | temp = sizeof(tLimMlmAssocInd); |
| 3003 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3004 | assoc_ind = qdf_mem_malloc(temp); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 3005 | if (!assoc_ind) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3006 | lim_release_peer_idx(mac_ctx, sta_ds->assocId, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 3007 | session_entry); |
Gu xiaocong | 6dbe3ba | 2021-07-06 13:20:58 +0800 | [diff] [blame^] | 3008 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3009 | } |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 3010 | if (!lim_fill_lim_assoc_ind_params(assoc_ind, mac_ctx, |
| 3011 | sta_ds, session_entry)) { |
| 3012 | qdf_mem_free(assoc_ind); |
Gu xiaocong | 6dbe3ba | 2021-07-06 13:20:58 +0800 | [diff] [blame^] | 3013 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3014 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3015 | lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_IND, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 3016 | (uint32_t *)assoc_ind); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3017 | qdf_mem_free(assoc_ind); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3018 | } |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 3019 | |
Gu xiaocong | 6dbe3ba | 2021-07-06 13:20:58 +0800 | [diff] [blame^] | 3020 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3021 | } |