Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
| 19 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 20 | * This file lim_process_action_frame.cc contains the code |
| 21 | * for processing Action Frame. |
| 22 | * Author: Michael Lui |
| 23 | * Date: 05/23/03 |
| 24 | * History:- |
| 25 | * Date Modified by Modification Information |
| 26 | * -------------------------------------------------------------------- |
| 27 | * |
| 28 | */ |
| 29 | #include "cds_api.h" |
| 30 | #include "wni_api.h" |
| 31 | #include "sir_api.h" |
| 32 | #include "ani_global.h" |
| 33 | #include "wni_cfg.h" |
| 34 | #include "sch_api.h" |
| 35 | #include "utils_api.h" |
| 36 | #include "lim_types.h" |
| 37 | #include "lim_utils.h" |
| 38 | #include "lim_assoc_utils.h" |
| 39 | #include "lim_security_utils.h" |
| 40 | #include "lim_ser_des_utils.h" |
| 41 | #include "lim_send_sme_rsp_messages.h" |
| 42 | #include "parser_api.h" |
| 43 | #include "lim_admit_control.h" |
| 44 | #include "wmm_apsd.h" |
| 45 | #include "lim_send_messages.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 46 | #include "rrm_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 47 | #include "lim_session_utils.h" |
Tushnim Bhattacharyya | 66348bd | 2017-03-09 15:02:10 -0800 | [diff] [blame] | 48 | #include "wlan_policy_mgr_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 49 | #include "wma_types.h" |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 50 | #include "wma.h" |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 51 | #include <cdp_txrx_cmn.h> |
Tushnim Bhattacharyya | 45ed04f | 2017-03-15 10:15:05 -0700 | [diff] [blame] | 52 | #include <cdp_txrx_peer_ops.h> |
Jianmin Zhu | 2f708f2 | 2018-07-23 22:07:05 +0800 | [diff] [blame] | 53 | #include "dot11f.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 54 | |
| 55 | #define BA_DEFAULT_TX_BUFFER_SIZE 64 |
| 56 | |
Arif Hussain | 776ee7a | 2016-11-10 20:28:50 -0800 | [diff] [blame] | 57 | static last_processed_msg rrm_link_action_frm; |
| 58 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 59 | /* Note: The test passes if the STAUT stops sending any frames, and no further |
| 60 | frames are transmitted on this channel by the station when the AP has sent |
| 61 | the last 6 beacons, with the channel switch information elements as seen |
| 62 | with the sniffer.*/ |
| 63 | #define SIR_CHANSW_TX_STOP_MAX_COUNT 6 |
| 64 | /**----------------------------------------------------------------- |
| 65 | \fn lim_stop_tx_and_switch_channel |
| 66 | \brief Stops the transmission if channel switch mode is silent and |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 67 | starts the channel switch timer. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 68 | |
Jeff Johnson | 982fe96 | 2018-11-28 17:07:01 -0800 | [diff] [blame] | 69 | \param mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 70 | \return NONE |
| 71 | -----------------------------------------------------------------*/ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 72 | void lim_stop_tx_and_switch_channel(struct mac_context *mac, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 73 | { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 74 | struct pe_session *pe_session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 75 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 76 | pe_session = pe_find_session_by_session_id(mac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 77 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 78 | if (NULL == pe_session) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 79 | pe_err("Session: %d not active", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 80 | return; |
| 81 | } |
| 82 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 83 | if (pe_session->ftPEContext.pFTPreAuthReq) { |
Padma, Santhosh Kumar | 9397bc1 | 2017-04-17 15:19:30 +0530 | [diff] [blame] | 84 | pe_debug("Avoid Switch Channel req during pre auth"); |
| 85 | return; |
| 86 | } |
| 87 | |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 88 | pe_debug("Channel switch Mode: %d", |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 89 | pe_session->gLimChannelSwitch.switchMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 90 | |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 91 | mac->lim.limTimers.gLimChannelSwitchTimer.sessionId = sessionId; |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 92 | /* change the channel immediately only if |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 93 | * the channel switch count is 0 |
| 94 | */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 95 | if (pe_session->gLimChannelSwitch.switchCount == 0) { |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 96 | lim_process_channel_switch_timeout(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 97 | return; |
| 98 | } |
| 99 | MTRACE(mac_trace |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 100 | (mac, TRACE_CODE_TIMER_ACTIVATE, sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 101 | eLIM_CHANNEL_SWITCH_TIMER)); |
| 102 | |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 103 | if (tx_timer_activate(&mac->lim.limTimers.gLimChannelSwitchTimer) != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 104 | TX_SUCCESS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 105 | pe_err("tx_timer_activate failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 106 | } |
| 107 | return; |
| 108 | } |
| 109 | |
| 110 | /**------------------------------------------------------------ |
| 111 | \fn lim_start_channel_switch |
| 112 | \brief Switches the channel if switch count == 0, otherwise |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 113 | starts the timer for channel switch and stops BG scan |
| 114 | and heartbeat timer tempororily. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 115 | |
Jeff Johnson | 982fe96 | 2018-11-28 17:07:01 -0800 | [diff] [blame] | 116 | \param mac |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 117 | \param pe_session |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 118 | \return NONE |
| 119 | ------------------------------------------------------------*/ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 120 | QDF_STATUS lim_start_channel_switch(struct mac_context *mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 121 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 122 | { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 123 | pe_debug("Starting the channel switch"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 124 | |
| 125 | /*If channel switch is already running and it is on a different session, just return */ |
| 126 | /*This need to be removed for MCC */ |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 127 | if ((lim_is_chan_switch_running(mac) && |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 128 | pe_session->gLimSpecMgmt.dot11hChanSwState != |
| 129 | eLIM_11H_CHANSW_RUNNING) || pe_session->csaOffloadEnable) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 130 | pe_warn("Ignoring channel switch on session: %d", |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 131 | pe_session->peSessionId); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 132 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | /* Deactivate and change reconfigure the timeout value */ |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 136 | /* lim_deactivate_and_change_timer(mac, eLIM_CHANNEL_SWITCH_TIMER); */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 137 | MTRACE(mac_trace |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 138 | (mac, TRACE_CODE_TIMER_DEACTIVATE, pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 139 | eLIM_CHANNEL_SWITCH_TIMER)); |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 140 | if (tx_timer_deactivate(&mac->lim.limTimers.gLimChannelSwitchTimer) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 141 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 142 | pe_err("tx_timer_deactivate failed!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 143 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 144 | } |
| 145 | |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 146 | if (tx_timer_change(&mac->lim.limTimers.gLimChannelSwitchTimer, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 147 | pe_session->gLimChannelSwitch.switchTimeoutValue, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 148 | 0) != TX_SUCCESS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 149 | pe_err("tx_timer_change failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 150 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 151 | } |
| 152 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 153 | /* Prepare for 11h channel switch */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 154 | lim_prepare_for11h_channel_switch(mac, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 155 | |
| 156 | /** Dont add any more statements here as we posted finish scan request |
| 157 | * to HAL, wait till we get the response |
| 158 | */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 159 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | /** |
| 163 | * __lim_process_channel_switch_action_frame() - to process channel switch |
| 164 | * @mac_ctx: Pointer to Global MAC structure |
| 165 | * @rx_pkt_info: A pointer to packet info structure |
| 166 | * |
| 167 | * This routine will be called to process channel switch action frame |
| 168 | * |
| 169 | * Return: None |
| 170 | */ |
| 171 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 172 | static void __lim_process_channel_switch_action_frame(struct mac_context *mac_ctx, |
Jeff Johnson | 41ce285 | 2018-11-19 06:51:22 -0800 | [diff] [blame] | 173 | uint8_t *rx_pkt_info, struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 174 | { |
| 175 | tpSirMacMgmtHdr mac_hdr; |
| 176 | uint8_t *body_ptr; |
| 177 | tDot11fChannelSwitch *chnl_switch_frame; |
| 178 | uint16_t bcn_period; |
| 179 | uint32_t val, frame_len, status; |
| 180 | tLimChannelSwitchInfo *ch_switch_params; |
| 181 | struct sDot11fIEWiderBWChanSwitchAnn *wbw_chnlswitch_ie = NULL; |
| 182 | struct sLimWiderBWChannelSwitch *lim_wbw_chnlswitch_info = NULL; |
| 183 | struct sDot11fIEsec_chan_offset_ele *sec_chnl_offset = NULL; |
| 184 | |
| 185 | mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 186 | body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 187 | frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 188 | |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 189 | pe_debug("Received Channel switch action frame"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 190 | if (!session->lim11hEnable) |
| 191 | return; |
| 192 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 193 | chnl_switch_frame = qdf_mem_malloc(sizeof(*chnl_switch_frame)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 194 | if (!chnl_switch_frame) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 195 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 196 | |
| 197 | /* Unpack channel switch frame */ |
| 198 | status = dot11f_unpack_channel_switch(mac_ctx, body_ptr, frame_len, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 199 | chnl_switch_frame, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 200 | |
| 201 | if (DOT11F_FAILED(status)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 202 | pe_err("Failed to unpack and parse (0x%08x, %d bytes)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 203 | status, frame_len); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 204 | qdf_mem_free(chnl_switch_frame); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 205 | return; |
| 206 | } else if (DOT11F_WARNED(status)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 207 | pe_warn("warning: unpack 11h-CHANSW Req(0x%08x, %d bytes)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 208 | status, frame_len); |
| 209 | } |
| 210 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 211 | if (qdf_mem_cmp((uint8_t *) &session->bssId, |
| 212 | (uint8_t *) &mac_hdr->sa, sizeof(tSirMacAddr))) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 213 | pe_warn("Rcvd action frame not from our BSS, dropping"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 214 | qdf_mem_free(chnl_switch_frame); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 215 | return; |
| 216 | } |
| 217 | /* copy the beacon interval from session */ |
| 218 | val = session->beaconParams.beaconInterval; |
| 219 | ch_switch_params = &session->gLimChannelSwitch; |
| 220 | bcn_period = (uint16_t)val; |
| 221 | ch_switch_params->primaryChannel = |
| 222 | chnl_switch_frame->ChanSwitchAnn.newChannel; |
| 223 | ch_switch_params->switchCount = |
| 224 | chnl_switch_frame->ChanSwitchAnn.switchCount; |
| 225 | ch_switch_params->switchTimeoutValue = |
| 226 | SYS_MS_TO_TICKS(bcn_period) * |
| 227 | session->gLimChannelSwitch.switchCount; |
| 228 | ch_switch_params->switchMode = |
| 229 | chnl_switch_frame->ChanSwitchAnn.switchMode; |
| 230 | |
| 231 | /* Only primary channel switch element is present */ |
| 232 | ch_switch_params->state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY; |
| 233 | ch_switch_params->ch_width = CH_WIDTH_20MHZ; |
| 234 | |
| 235 | if (chnl_switch_frame->WiderBWChanSwitchAnn.present |
| 236 | && session->vhtCapability) { |
| 237 | wbw_chnlswitch_ie = &chnl_switch_frame->WiderBWChanSwitchAnn; |
| 238 | session->gLimWiderBWChannelSwitch.newChanWidth = |
| 239 | wbw_chnlswitch_ie->newChanWidth; |
| 240 | session->gLimWiderBWChannelSwitch.newCenterChanFreq0 = |
| 241 | wbw_chnlswitch_ie->newCenterChanFreq0; |
| 242 | session->gLimWiderBWChannelSwitch.newCenterChanFreq1 = |
| 243 | wbw_chnlswitch_ie->newCenterChanFreq1; |
| 244 | } |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 245 | pe_debug("Rcv Chnl Swtch Frame: Timeout in %d ticks", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 246 | session->gLimChannelSwitch.switchTimeoutValue); |
| 247 | if (session->htSupportedChannelWidthSet) { |
| 248 | sec_chnl_offset = &chnl_switch_frame->sec_chan_offset_ele; |
| 249 | if (sec_chnl_offset->secondaryChannelOffset == |
| 250 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY) { |
| 251 | ch_switch_params->state = |
| 252 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 253 | ch_switch_params->ch_width = CH_WIDTH_40MHZ; |
| 254 | ch_switch_params->ch_center_freq_seg0 = |
| 255 | ch_switch_params->primaryChannel + 2; |
| 256 | } else if (sec_chnl_offset->secondaryChannelOffset == |
| 257 | PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) { |
| 258 | ch_switch_params->state = |
| 259 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 260 | ch_switch_params->ch_width = CH_WIDTH_40MHZ; |
| 261 | ch_switch_params->ch_center_freq_seg0 = |
| 262 | ch_switch_params->primaryChannel - 2; |
| 263 | |
| 264 | } |
| 265 | if (session->vhtCapability && |
| 266 | chnl_switch_frame->WiderBWChanSwitchAnn.present) { |
| 267 | wbw_chnlswitch_ie = |
| 268 | &chnl_switch_frame->WiderBWChanSwitchAnn; |
| 269 | ch_switch_params->ch_width = |
| 270 | wbw_chnlswitch_ie->newChanWidth + 1; |
| 271 | lim_wbw_chnlswitch_info = |
| 272 | &session->gLimWiderBWChannelSwitch; |
| 273 | ch_switch_params->ch_center_freq_seg0 = |
| 274 | lim_wbw_chnlswitch_info->newCenterChanFreq0; |
| 275 | ch_switch_params->ch_center_freq_seg1 = |
| 276 | lim_wbw_chnlswitch_info->newCenterChanFreq1; |
| 277 | |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | if (CH_WIDTH_20MHZ == ch_switch_params->ch_width) { |
| 282 | session->htSupportedChannelWidthSet = |
| 283 | WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 284 | session->htRecommendedTxWidthSet = |
| 285 | session->htSupportedChannelWidthSet; |
| 286 | } |
| 287 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 288 | if (QDF_STATUS_SUCCESS != lim_start_channel_switch(mac_ctx, session)) |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 289 | pe_err("Could not start channel switch"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 290 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 291 | qdf_mem_free(chnl_switch_frame); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 292 | return; |
| 293 | } |
| 294 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 295 | /** |
| 296 | * lim_process_ext_channel_switch_action_frame()- Process ECSA Action |
| 297 | * Frames. |
| 298 | * @mac_ctx: pointer to global mac structure |
| 299 | * @rx_packet_info: rx packet meta information |
| 300 | * @session_entry: Session entry. |
| 301 | * |
| 302 | * This function is called when ECSA action frame is received. |
| 303 | * |
| 304 | * Return: void |
| 305 | */ |
| 306 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 307 | lim_process_ext_channel_switch_action_frame(struct mac_context *mac_ctx, |
Jeff Johnson | 41ce285 | 2018-11-19 06:51:22 -0800 | [diff] [blame] | 308 | uint8_t *rx_packet_info, struct pe_session *session_entry) |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 309 | { |
| 310 | |
| 311 | tpSirMacMgmtHdr hdr; |
| 312 | uint8_t *body; |
| 313 | tDot11fext_channel_switch_action_frame *ext_channel_switch_frame; |
| 314 | uint32_t frame_len; |
| 315 | uint32_t status; |
| 316 | uint8_t target_channel; |
| 317 | |
| 318 | hdr = WMA_GET_RX_MAC_HEADER(rx_packet_info); |
| 319 | body = WMA_GET_RX_MPDU_DATA(rx_packet_info); |
| 320 | frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_packet_info); |
| 321 | |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 322 | pe_debug("Received EXT Channel switch action frame"); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 323 | |
| 324 | ext_channel_switch_frame = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 325 | qdf_mem_malloc(sizeof(*ext_channel_switch_frame)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 326 | if (!ext_channel_switch_frame) |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 327 | return; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 328 | |
| 329 | /* Unpack channel switch frame */ |
| 330 | status = dot11f_unpack_ext_channel_switch_action_frame(mac_ctx, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 331 | body, frame_len, ext_channel_switch_frame, false); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 332 | |
| 333 | if (DOT11F_FAILED(status)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 334 | pe_err("Failed to parse CHANSW action frame (0x%08x, len %d):", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 335 | status, frame_len); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 336 | qdf_mem_free(ext_channel_switch_frame); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 337 | return; |
| 338 | } else if (DOT11F_WARNED(status)) { |
Rajeev Kumar | b581380 | 2017-06-29 17:34:57 -0700 | [diff] [blame] | 339 | pe_debug("There were warnings while unpacking CHANSW Request (0x%08x, %d bytes):", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 340 | status, frame_len); |
| 341 | } |
| 342 | |
| 343 | target_channel = |
| 344 | ext_channel_switch_frame->ext_chan_switch_ann_action.new_channel; |
| 345 | |
| 346 | /* Free ext_channel_switch_frame here as its no longer needed */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 347 | qdf_mem_free(ext_channel_switch_frame); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 348 | /* |
| 349 | * Now, validate if channel change is required for the passed |
| 350 | * channel and if is valid in the current regulatory domain, |
| 351 | * and no concurrent session is running. |
| 352 | */ |
| 353 | if (!((session_entry->currentOperChannel != target_channel) && |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 354 | ((wlan_reg_get_channel_state(mac_ctx->pdev, target_channel) == |
| 355 | CHANNEL_STATE_ENABLE) || |
| 356 | (wlan_reg_get_channel_state(mac_ctx->pdev, target_channel) == |
| 357 | CHANNEL_STATE_DFS && |
| 358 | !policy_mgr_concurrent_open_sessions_running( |
| 359 | mac_ctx->psoc))))) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 360 | pe_err("Channel: %d is not valid", target_channel); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 361 | return; |
| 362 | } |
| 363 | |
Visweswara Tanuku | d0c726b | 2018-04-09 18:14:08 +0530 | [diff] [blame] | 364 | if ((eLIM_STA_ROLE == session_entry->limSystemRole) || |
| 365 | (eLIM_P2P_DEVICE_CLIENT == session_entry->limSystemRole)) { |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 366 | |
| 367 | struct sir_sme_ext_cng_chan_ind *ext_cng_chan_ind; |
Rajeev Kumar | cf7bd80 | 2017-04-18 11:11:42 -0700 | [diff] [blame] | 368 | struct scheduler_msg mmh_msg = {0}; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 369 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 370 | ext_cng_chan_ind = qdf_mem_malloc(sizeof(*ext_cng_chan_ind)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 371 | if (!ext_cng_chan_ind) |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 372 | return; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 373 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 374 | ext_cng_chan_ind->session_id = |
| 375 | session_entry->smeSessionId; |
| 376 | |
| 377 | /* No need to extract op mode as BW will be decided in |
| 378 | * in SAP FSM depending on previous BW. |
| 379 | */ |
| 380 | ext_cng_chan_ind->new_channel = target_channel; |
| 381 | |
| 382 | mmh_msg.type = eWNI_SME_EXT_CHANGE_CHANNEL_IND; |
| 383 | mmh_msg.bodyptr = ext_cng_chan_ind; |
| 384 | mmh_msg.bodyval = 0; |
| 385 | lim_sys_process_mmh_msg_api(mac_ctx, &mmh_msg, ePROT); |
| 386 | } |
| 387 | return; |
| 388 | } /*** end lim_process_ext_channel_switch_action_frame() ***/ |
| 389 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 390 | /** |
| 391 | * __lim_process_operating_mode_action_frame() - To process op mode frames |
| 392 | * @mac_ctx: pointer to mac context |
| 393 | * @rx_pkt_info: pointer to received packet info |
| 394 | * @session: pointer to session |
| 395 | * |
| 396 | * This routine is called to process operating mode action frames |
| 397 | * |
| 398 | * Return: None |
| 399 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 400 | static void __lim_process_operating_mode_action_frame(struct mac_context *mac_ctx, |
Jeff Johnson | 41ce285 | 2018-11-19 06:51:22 -0800 | [diff] [blame] | 401 | uint8_t *rx_pkt_info, struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 402 | { |
| 403 | |
| 404 | tpSirMacMgmtHdr mac_hdr; |
| 405 | uint8_t *body_ptr; |
| 406 | tDot11fOperatingMode *operating_mode_frm; |
| 407 | uint32_t frame_len; |
| 408 | uint32_t status; |
| 409 | tpDphHashNode sta_ptr; |
| 410 | uint16_t aid; |
| 411 | uint8_t oper_mode; |
| 412 | uint8_t cb_mode; |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 413 | uint8_t ch_bw = 0; |
| 414 | uint8_t skip_opmode_update = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 415 | |
| 416 | mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 417 | body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 418 | frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 419 | |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 420 | pe_debug("Received Operating Mode action frame"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 421 | operating_mode_frm = qdf_mem_malloc(sizeof(*operating_mode_frm)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 422 | if (!operating_mode_frm) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 423 | return; |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 424 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 425 | /* Unpack channel switch frame */ |
| 426 | status = dot11f_unpack_operating_mode(mac_ctx, body_ptr, frame_len, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 427 | operating_mode_frm, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 428 | if (DOT11F_FAILED(status)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 429 | pe_err("Failed to unpack and parse (0x%08x, %d bytes)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 430 | status, frame_len); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 431 | qdf_mem_free(operating_mode_frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 432 | return; |
| 433 | } else if (DOT11F_WARNED(status)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 434 | pe_warn("warnings while unpacking (0x%08x, %d bytes):", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 435 | status, frame_len); |
| 436 | } |
| 437 | sta_ptr = dph_lookup_hash_entry(mac_ctx, mac_hdr->sa, &aid, |
| 438 | &session->dph.dphHashTable); |
Padma, Santhosh Kumar | 79412ed | 2016-08-09 16:21:11 +0530 | [diff] [blame] | 439 | |
| 440 | if (sta_ptr == NULL) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 441 | pe_err("Station context not found"); |
Padma, Santhosh Kumar | 79412ed | 2016-08-09 16:21:11 +0530 | [diff] [blame] | 442 | goto end; |
| 443 | } |
| 444 | |
Naveen Rawat | 2f13193 | 2017-12-19 16:23:00 -0800 | [diff] [blame] | 445 | if (CHAN_ENUM_14 >= session->currentOperChannel) |
| 446 | cb_mode = mac_ctx->roam.configParam.channelBondingMode24GHz; |
| 447 | else |
| 448 | cb_mode = mac_ctx->roam.configParam.channelBondingMode5GHz; |
| 449 | /* |
| 450 | * Do not update the channel bonding mode if channel bonding |
| 451 | * mode is disabled in INI. |
| 452 | */ |
| 453 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE == cb_mode) { |
Naveen Rawat | 170420a | 2017-12-21 14:33:55 -0800 | [diff] [blame] | 454 | pe_debug("channel bonding disabled"); |
Naveen Rawat | 2f13193 | 2017-12-19 16:23:00 -0800 | [diff] [blame] | 455 | goto update_nss; |
| 456 | } |
| 457 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 458 | if (sta_ptr->htSupportedChannelWidthSet) { |
| 459 | if (WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ < |
| 460 | sta_ptr->vhtSupportedChannelWidthSet) |
| 461 | oper_mode = eHT_CHANNEL_WIDTH_160MHZ; |
| 462 | else |
| 463 | oper_mode = sta_ptr->vhtSupportedChannelWidthSet + 1; |
| 464 | } else { |
| 465 | oper_mode = eHT_CHANNEL_WIDTH_20MHZ; |
| 466 | } |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 467 | |
| 468 | if ((oper_mode == eHT_CHANNEL_WIDTH_80MHZ) && |
| 469 | (operating_mode_frm->OperatingMode.chanWidth > |
| 470 | eHT_CHANNEL_WIDTH_80MHZ)) |
| 471 | skip_opmode_update = true; |
| 472 | |
| 473 | if (!skip_opmode_update && (oper_mode != |
| 474 | operating_mode_frm->OperatingMode.chanWidth)) { |
| 475 | uint32_t fw_vht_ch_wd = wma_get_vht_ch_width(); |
| 476 | |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 477 | pe_debug("received Chanwidth: %d staIdx: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 478 | (operating_mode_frm->OperatingMode.chanWidth), |
| 479 | sta_ptr->staIndex); |
| 480 | |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 481 | pe_debug(" MAC: %0x:%0x:%0x:%0x:%0x:%0x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 482 | mac_hdr->sa[0], mac_hdr->sa[1], mac_hdr->sa[2], |
| 483 | mac_hdr->sa[3], mac_hdr->sa[4], mac_hdr->sa[5]); |
| 484 | |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 485 | if (operating_mode_frm->OperatingMode.chanWidth >= |
| 486 | eHT_CHANNEL_WIDTH_160MHZ |
| 487 | && (fw_vht_ch_wd >= eHT_CHANNEL_WIDTH_160MHZ)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 488 | sta_ptr->vhtSupportedChannelWidthSet = |
| 489 | WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ; |
| 490 | sta_ptr->htSupportedChannelWidthSet = |
| 491 | eHT_CHANNEL_WIDTH_40MHZ; |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 492 | ch_bw = eHT_CHANNEL_WIDTH_160MHZ; |
| 493 | } else if (operating_mode_frm->OperatingMode.chanWidth >= |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 494 | eHT_CHANNEL_WIDTH_80MHZ) { |
| 495 | sta_ptr->vhtSupportedChannelWidthSet = |
| 496 | WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ; |
| 497 | sta_ptr->htSupportedChannelWidthSet = |
| 498 | eHT_CHANNEL_WIDTH_40MHZ; |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 499 | ch_bw = eHT_CHANNEL_WIDTH_80MHZ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 500 | } else if (operating_mode_frm->OperatingMode.chanWidth == |
| 501 | eHT_CHANNEL_WIDTH_40MHZ) { |
| 502 | sta_ptr->vhtSupportedChannelWidthSet = |
| 503 | WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ; |
| 504 | sta_ptr->htSupportedChannelWidthSet = |
| 505 | eHT_CHANNEL_WIDTH_40MHZ; |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 506 | ch_bw = eHT_CHANNEL_WIDTH_40MHZ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 507 | } else if (operating_mode_frm->OperatingMode.chanWidth == |
| 508 | eHT_CHANNEL_WIDTH_20MHZ) { |
| 509 | sta_ptr->vhtSupportedChannelWidthSet = |
| 510 | WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ; |
| 511 | sta_ptr->htSupportedChannelWidthSet = |
| 512 | eHT_CHANNEL_WIDTH_20MHZ; |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 513 | ch_bw = eHT_CHANNEL_WIDTH_20MHZ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 514 | } |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 515 | lim_check_vht_op_mode_change(mac_ctx, session, ch_bw, |
| 516 | sta_ptr->staIndex, mac_hdr->sa); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 517 | } |
| 518 | |
Naveen Rawat | 2f13193 | 2017-12-19 16:23:00 -0800 | [diff] [blame] | 519 | update_nss: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 520 | if (sta_ptr->vhtSupportedRxNss != |
| 521 | (operating_mode_frm->OperatingMode.rxNSS + 1)) { |
| 522 | sta_ptr->vhtSupportedRxNss = |
| 523 | operating_mode_frm->OperatingMode.rxNSS + 1; |
Naveen Rawat | 5b933dc | 2016-10-31 09:39:43 -0700 | [diff] [blame] | 524 | lim_set_nss_change(mac_ctx, session, sta_ptr->vhtSupportedRxNss, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 525 | sta_ptr->staIndex, mac_hdr->sa); |
| 526 | } |
Padma, Santhosh Kumar | 79412ed | 2016-08-09 16:21:11 +0530 | [diff] [blame] | 527 | |
| 528 | end: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 529 | qdf_mem_free(operating_mode_frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 530 | return; |
| 531 | } |
| 532 | |
| 533 | /** |
| 534 | * __lim_process_gid_management_action_frame() - To process group-id mgmt frames |
| 535 | * @mac_ctx: Pointer to mac context |
| 536 | * @rx_pkt_info: Rx packet info |
| 537 | * @session: pointer to session |
| 538 | * |
| 539 | * This routine will be called to process group id management frames |
| 540 | * |
| 541 | * Return: none |
| 542 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 543 | static void __lim_process_gid_management_action_frame(struct mac_context *mac_ctx, |
Jeff Johnson | 41ce285 | 2018-11-19 06:51:22 -0800 | [diff] [blame] | 544 | uint8_t *rx_pkt_info, struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 545 | { |
| 546 | |
| 547 | uint8_t *body_ptr; |
| 548 | uint16_t aid; |
| 549 | uint32_t frame_len, status, membership = 0, usr_position = 0; |
| 550 | uint32_t *mem_lower, *mem_upper, *mem_cur; |
| 551 | tpSirMacMgmtHdr mac_hdr; |
| 552 | tDot11fVHTGidManagementActionFrame *gid_mgmt_frame; |
| 553 | tpDphHashNode sta_ptr; |
| 554 | struct sDot11fFfVhtMembershipStatusArray *vht_member_status = NULL; |
| 555 | struct sDot11fFfVhtUserPositionArray *vht_user_position = NULL; |
| 556 | |
| 557 | mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 558 | body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 559 | frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 560 | |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 561 | pe_debug("Received GID Management action frame"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 562 | gid_mgmt_frame = qdf_mem_malloc(sizeof(*gid_mgmt_frame)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 563 | if (!gid_mgmt_frame) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 564 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 565 | |
Jeff Johnson | 9020f0c | 2018-05-06 08:08:25 -0700 | [diff] [blame] | 566 | /* Unpack Gid Management Action frame */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 567 | status = dot11f_unpack_vht_gid_management_action_frame(mac_ctx, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 568 | body_ptr, frame_len, gid_mgmt_frame, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 569 | if (DOT11F_FAILED(status)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 570 | pe_err("Fail to parse an Grp id frame (0x%08x, %d bytes):", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 571 | status, frame_len); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 572 | qdf_mem_free(gid_mgmt_frame); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 573 | return; |
| 574 | } else if (DOT11F_WARNED(status)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 575 | pe_warn("warnings while unpacking Grp id frm (0x%08x, %d bytes):", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 576 | status, frame_len); |
| 577 | } |
| 578 | sta_ptr = dph_lookup_hash_entry(mac_ctx, mac_hdr->sa, &aid, |
| 579 | &session->dph.dphHashTable); |
Arif Hussain | 4a68239 | 2016-10-25 13:59:03 -0700 | [diff] [blame] | 580 | if (!sta_ptr) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 581 | pe_err("Failed to get STA entry from hash table"); |
Arif Hussain | 4a68239 | 2016-10-25 13:59:03 -0700 | [diff] [blame] | 582 | goto out; |
| 583 | } |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 584 | pe_debug("received Gid Management Action Frame staIdx: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 585 | sta_ptr->staIndex); |
| 586 | |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 587 | pe_debug(" MAC: %0x:%0x:%0x:%0x:%0x:%0x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 588 | mac_hdr->sa[0], mac_hdr->sa[1], mac_hdr->sa[2], |
| 589 | mac_hdr->sa[3], mac_hdr->sa[4], mac_hdr->sa[5]); |
| 590 | vht_member_status = &gid_mgmt_frame->VhtMembershipStatusArray; |
| 591 | mem_lower = (uint32_t *) vht_member_status->membershipStatusArray; |
| 592 | mem_upper = (uint32_t *) &vht_member_status->membershipStatusArray[4]; |
| 593 | |
| 594 | if (*mem_lower && *mem_upper) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 595 | pe_err("rcved frame with mult group ID set, staIdx = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 596 | sta_ptr->staIndex); |
| 597 | goto out; |
| 598 | } |
| 599 | if (*mem_lower) { |
| 600 | mem_cur = mem_lower; |
| 601 | } else if (*mem_upper) { |
| 602 | mem_cur = mem_upper; |
| 603 | membership += sizeof(uint32_t); |
| 604 | } else { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 605 | pe_err("rcved Gid frame with no group ID set, staIdx: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 606 | sta_ptr->staIndex); |
| 607 | goto out; |
| 608 | } |
| 609 | while (!(*mem_cur & 1)) { |
| 610 | *mem_cur >>= 1; |
| 611 | ++membership; |
| 612 | } |
| 613 | if (*mem_cur) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 614 | pe_err("rcved frame with mult group ID set, staIdx: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 615 | sta_ptr->staIndex); |
| 616 | goto out; |
| 617 | } |
| 618 | |
| 619 | /*Just read the last two bits */ |
| 620 | vht_user_position = &gid_mgmt_frame->VhtUserPositionArray; |
| 621 | usr_position = vht_user_position->userPositionArray[membership] & 0x3; |
| 622 | lim_check_membership_user_position(mac_ctx, session, membership, |
| 623 | usr_position, sta_ptr->staIndex); |
| 624 | out: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 625 | qdf_mem_free(gid_mgmt_frame); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 626 | return; |
| 627 | } |
| 628 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 629 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 630 | __lim_process_add_ts_req(struct mac_context *mac, uint8_t *pRxPacketInfo, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 631 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 632 | { |
| 633 | } |
| 634 | |
| 635 | /** |
| 636 | * __lim_process_add_ts_rsp() - To process add ts response frame |
| 637 | * @mac_ctx: pointer to mac context |
| 638 | * @rx_pkt_info: Received packet info |
| 639 | * @session: pointer to session |
| 640 | * |
| 641 | * This routine is to handle add ts response frame |
| 642 | * |
| 643 | * Return: none |
| 644 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 645 | static void __lim_process_add_ts_rsp(struct mac_context *mac_ctx, |
Jeff Johnson | 41ce285 | 2018-11-19 06:51:22 -0800 | [diff] [blame] | 646 | uint8_t *rx_pkt_info, struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 647 | { |
| 648 | tSirAddtsRspInfo addts; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 649 | QDF_STATUS retval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 650 | tpSirMacMgmtHdr mac_hdr; |
| 651 | tpDphHashNode sta_ptr; |
| 652 | uint16_t aid; |
| 653 | uint32_t frameLen; |
| 654 | uint8_t *body_ptr; |
| 655 | tpLimTspecInfo tspec_info; |
| 656 | uint8_t ac; |
| 657 | tpDphHashNode sta_ds_ptr = NULL; |
| 658 | uint8_t rsp_reqd = 1; |
| 659 | uint32_t cfg_len; |
| 660 | tSirMacAddr peer_macaddr; |
| 661 | |
| 662 | mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 663 | body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 664 | frameLen = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 665 | |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 666 | pe_warn("Recv AddTs Response"); |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 667 | if (LIM_IS_AP_ROLE(session)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 668 | pe_warn("AddTsRsp recvd at AP: ignoring"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 669 | return; |
| 670 | } |
| 671 | |
| 672 | sta_ptr = dph_lookup_hash_entry(mac_ctx, mac_hdr->sa, &aid, |
| 673 | &session->dph.dphHashTable); |
| 674 | if (sta_ptr == NULL) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 675 | pe_err("Station context not found - ignoring AddTsRsp"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 676 | return; |
| 677 | } |
| 678 | |
| 679 | retval = sir_convert_addts_rsp2_struct(mac_ctx, body_ptr, |
| 680 | frameLen, &addts); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 681 | if (retval != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 682 | pe_err("AddTsRsp parsing failed %d", retval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 683 | return; |
| 684 | } |
| 685 | /* |
| 686 | * don't have to check for qos/wme capabilities since we wouldn't have |
| 687 | * this flag set otherwise |
| 688 | */ |
| 689 | if (!mac_ctx->lim.gLimAddtsSent) { |
| 690 | /* we never sent an addts request! */ |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 691 | pe_warn("rx AddTsRsp but no req was ever sent-ignoring"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 692 | return; |
| 693 | } |
| 694 | |
| 695 | if (mac_ctx->lim.gLimAddtsReq.req.dialogToken != addts.dialogToken) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 696 | pe_warn("token mismatch got: %d exp: %d - ignoring", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 697 | addts.dialogToken, |
| 698 | mac_ctx->lim.gLimAddtsReq.req.dialogToken); |
| 699 | return; |
| 700 | } |
| 701 | |
| 702 | /* |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 703 | * for successful addts response, try to add the classifier. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 704 | * if this fails for any reason, we should send a delts request to the |
| 705 | * ap for now, its ok not to send a delts since we are going to add |
| 706 | * support for multiple tclas soon and until then we won't send any |
| 707 | * addts requests with multiple tclas elements anyway. |
| 708 | * In case of addClassifier failure, we just let the addts timer run out |
| 709 | */ |
| 710 | if (((addts.tspec.tsinfo.traffic.accessPolicy == |
| 711 | SIR_MAC_ACCESSPOLICY_HCCA) || |
| 712 | (addts.tspec.tsinfo.traffic.accessPolicy == |
| 713 | SIR_MAC_ACCESSPOLICY_BOTH)) && |
| 714 | (addts.status == eSIR_MAC_SUCCESS_STATUS)) { |
| 715 | /* add the classifier - this should always succeed */ |
| 716 | if (addts.numTclas > 1) { |
| 717 | /* currently no support for multiple tclas elements */ |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 718 | pe_err("Sta: %d Too many Tclas: %d 1 supported", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 719 | aid, addts.numTclas); |
| 720 | return; |
| 721 | } else if (addts.numTclas == 1) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 722 | pe_debug("Response from STA: %d tsid: %d UP: %d OK!", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 723 | aid, addts.tspec.tsinfo.traffic.tsid, |
| 724 | addts.tspec.tsinfo.traffic.userPrio); |
| 725 | } |
| 726 | } |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 727 | pe_debug("Recv AddTsRsp: tsid: %d UP: %d status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 728 | addts.tspec.tsinfo.traffic.tsid, |
| 729 | addts.tspec.tsinfo.traffic.userPrio, addts.status); |
| 730 | |
| 731 | /* deactivate the response timer */ |
| 732 | lim_deactivate_and_change_timer(mac_ctx, eLIM_ADDTS_RSP_TIMER); |
| 733 | |
| 734 | if (addts.status != eSIR_MAC_SUCCESS_STATUS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 735 | pe_debug("Recv AddTsRsp: tsid: %d UP: %d status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 736 | addts.tspec.tsinfo.traffic.tsid, |
| 737 | addts.tspec.tsinfo.traffic.userPrio, addts.status); |
| 738 | lim_send_sme_addts_rsp(mac_ctx, true, addts.status, session, |
| 739 | addts.tspec, session->smeSessionId, |
| 740 | session->transactionId); |
| 741 | |
| 742 | /* clear the addts flag */ |
| 743 | mac_ctx->lim.gLimAddtsSent = false; |
| 744 | |
| 745 | return; |
| 746 | } |
| 747 | #ifdef FEATURE_WLAN_ESE |
| 748 | if (addts.tsmPresent) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 749 | pe_debug("TSM IE Present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 750 | session->eseContext.tsm.tid = |
| 751 | addts.tspec.tsinfo.traffic.userPrio; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 752 | qdf_mem_copy(&session->eseContext.tsm.tsmInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 753 | &addts.tsmIE, sizeof(tSirMacESETSMIE)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 754 | lim_send_sme_tsm_ie_ind(mac_ctx, session, addts.tsmIE.tsid, |
| 755 | addts.tsmIE.state, |
| 756 | addts.tsmIE.msmt_interval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 757 | } |
| 758 | #endif |
| 759 | /* |
| 760 | * Since AddTS response was successful, check for the PSB flag |
| 761 | * and directional flag inside the TS Info field. |
| 762 | * An AC is trigger enabled AC if the PSB subfield is set to 1 |
| 763 | * in the uplink direction. |
| 764 | * An AC is delivery enabled AC if the PSB subfield is set to 1 |
| 765 | * in the downlink direction. |
| 766 | * An AC is trigger and delivery enabled AC if the PSB subfield |
| 767 | * is set to 1 in the bi-direction field. |
| 768 | */ |
| 769 | if (addts.tspec.tsinfo.traffic.psb == 1) |
| 770 | lim_set_tspec_uapsd_mask_per_session(mac_ctx, session, |
| 771 | &addts.tspec.tsinfo, |
| 772 | SET_UAPSD_MASK); |
| 773 | else |
| 774 | lim_set_tspec_uapsd_mask_per_session(mac_ctx, session, |
| 775 | &addts.tspec.tsinfo, |
| 776 | CLEAR_UAPSD_MASK); |
| 777 | |
| 778 | /* |
| 779 | * ADDTS success, so AC is now admitted. We shall now use the default |
| 780 | * EDCA parameters as advertised by AP and send the updated EDCA params |
| 781 | * to HAL. |
| 782 | */ |
| 783 | ac = upToAc(addts.tspec.tsinfo.traffic.userPrio); |
| 784 | if (addts.tspec.tsinfo.traffic.direction == |
| 785 | SIR_MAC_DIRECTION_UPLINK) { |
| 786 | session->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= |
| 787 | (1 << ac); |
| 788 | } else if (addts.tspec.tsinfo.traffic.direction == |
| 789 | SIR_MAC_DIRECTION_DNLINK) { |
| 790 | session->gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= |
| 791 | (1 << ac); |
| 792 | } else if (addts.tspec.tsinfo.traffic.direction == |
| 793 | SIR_MAC_DIRECTION_BIDIR) { |
| 794 | session->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= |
| 795 | (1 << ac); |
| 796 | session->gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= |
| 797 | (1 << ac); |
| 798 | } |
| 799 | lim_set_active_edca_params(mac_ctx, session->gLimEdcaParams, |
| 800 | session); |
| 801 | sta_ds_ptr = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, |
| 802 | &session->dph.dphHashTable); |
| 803 | if (sta_ds_ptr != NULL) |
| 804 | lim_send_edca_params(mac_ctx, session->gLimEdcaParamsActive, |
Kiran Kumar Lokere | 27026ae | 2018-03-09 11:38:19 -0800 | [diff] [blame] | 805 | sta_ds_ptr->bssId, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 806 | else |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 807 | pe_err("Self entry missing in Hash Table"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 808 | sir_copy_mac_addr(peer_macaddr, session->bssId); |
| 809 | /* if schedule is not present then add TSPEC with svcInterval as 0. */ |
| 810 | if (!addts.schedulePresent) |
| 811 | addts.schedule.svcInterval = 0; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 812 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 813 | lim_tspec_add(mac_ctx, sta_ptr->staAddr, sta_ptr->assocId, |
| 814 | &addts.tspec, addts.schedule.svcInterval, &tspec_info)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 815 | pe_err("Adding entry in lim Tspec Table failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 816 | lim_send_delts_req_action_frame(mac_ctx, peer_macaddr, rsp_reqd, |
| 817 | &addts.tspec.tsinfo, |
| 818 | &addts.tspec, session); |
| 819 | mac_ctx->lim.gLimAddtsSent = false; |
| 820 | return; |
| 821 | /* |
| 822 | * Error handling. send the response with error status. |
| 823 | * need to send DelTS to tear down the TSPEC status. |
| 824 | */ |
| 825 | } |
| 826 | if ((addts.tspec.tsinfo.traffic.accessPolicy != |
| 827 | SIR_MAC_ACCESSPOLICY_EDCA) || |
| 828 | ((upToAc(addts.tspec.tsinfo.traffic.userPrio) < MAX_NUM_AC))) { |
| 829 | #ifdef FEATURE_WLAN_ESE |
| 830 | retval = lim_send_hal_msg_add_ts(mac_ctx, |
| 831 | sta_ptr->staIndex, tspec_info->idx, |
| 832 | addts.tspec, session->peSessionId, |
| 833 | addts.tsmIE.msmt_interval); |
| 834 | #else |
| 835 | retval = lim_send_hal_msg_add_ts(mac_ctx, |
| 836 | sta_ptr->staIndex, tspec_info->idx, |
| 837 | addts.tspec, session->peSessionId); |
| 838 | #endif |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 839 | if (QDF_STATUS_SUCCESS != retval) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 840 | lim_admit_control_delete_ts(mac_ctx, sta_ptr->assocId, |
| 841 | &addts.tspec.tsinfo, NULL, &tspec_info->idx); |
| 842 | |
| 843 | /* Send DELTS action frame to AP */ |
| 844 | cfg_len = sizeof(tSirMacAddr); |
| 845 | lim_send_delts_req_action_frame(mac_ctx, peer_macaddr, |
| 846 | rsp_reqd, &addts.tspec.tsinfo, |
| 847 | &addts.tspec, session); |
| 848 | lim_send_sme_addts_rsp(mac_ctx, true, retval, |
| 849 | session, addts.tspec, |
| 850 | session->smeSessionId, |
| 851 | session->transactionId); |
| 852 | mac_ctx->lim.gLimAddtsSent = false; |
| 853 | return; |
| 854 | } |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 855 | pe_debug("AddTsRsp received successfully UP: %d TSID: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 856 | addts.tspec.tsinfo.traffic.userPrio, |
| 857 | addts.tspec.tsinfo.traffic.tsid); |
| 858 | } else { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 859 | pe_debug("AddTsRsp received successfully UP: %d TSID: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 860 | addts.tspec.tsinfo.traffic.userPrio, |
| 861 | addts.tspec.tsinfo.traffic.tsid); |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 862 | pe_debug("no ACM: Bypass sending WMA_ADD_TS_REQ to HAL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 863 | /* |
| 864 | * Use the smesessionId and smetransactionId from the PE |
| 865 | * session context |
| 866 | */ |
| 867 | lim_send_sme_addts_rsp(mac_ctx, true, eSIR_SME_SUCCESS, |
| 868 | session, addts.tspec, session->smeSessionId, |
| 869 | session->transactionId); |
| 870 | } |
| 871 | /* clear the addts flag */ |
| 872 | mac_ctx->lim.gLimAddtsSent = false; |
| 873 | return; |
| 874 | } |
| 875 | |
| 876 | /** |
| 877 | * __lim_process_del_ts_req() - To process del ts response frame |
| 878 | * @mac_ctx: pointer to mac context |
| 879 | * @rx_pkt_info: Received packet info |
| 880 | * @session: pointer to session |
| 881 | * |
| 882 | * This routine is to handle del ts request frame |
| 883 | * |
| 884 | * Return: none |
| 885 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 886 | static void __lim_process_del_ts_req(struct mac_context *mac_ctx, |
Jeff Johnson | 41ce285 | 2018-11-19 06:51:22 -0800 | [diff] [blame] | 887 | uint8_t *rx_pkt_info, struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 888 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 889 | QDF_STATUS retval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 890 | tSirDeltsReqInfo delts; |
| 891 | tpSirMacMgmtHdr mac_hdr; |
| 892 | tpDphHashNode sta_ptr; |
| 893 | uint32_t frame_len; |
| 894 | uint16_t aid; |
| 895 | uint8_t *body_ptr; |
| 896 | uint8_t ts_status; |
| 897 | tSirMacTSInfo *tsinfo; |
| 898 | uint8_t tspec_idx; |
| 899 | uint8_t ac; |
| 900 | tpDphHashNode sta_ds_ptr = NULL; |
| 901 | |
| 902 | mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 903 | body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 904 | frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 905 | |
| 906 | sta_ptr = dph_lookup_hash_entry(mac_ctx, mac_hdr->sa, &aid, |
| 907 | &session->dph.dphHashTable); |
| 908 | if (sta_ptr == NULL) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 909 | pe_err("Station context not found - ignoring DelTs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 910 | return; |
| 911 | } |
| 912 | /* parse the delts request */ |
| 913 | retval = sir_convert_delts_req2_struct(mac_ctx, body_ptr, |
| 914 | frame_len, &delts); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 915 | if (retval != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 916 | pe_err("DelTs parsing failed %d", retval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 917 | return; |
| 918 | } |
| 919 | |
| 920 | if (delts.wmeTspecPresent) { |
| 921 | if ((!session->limWmeEnabled) || (!sta_ptr->wmeEnabled)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 922 | pe_warn("Ignore delts req: wme not enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 923 | return; |
| 924 | } |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 925 | pe_debug("WME Delts received"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 926 | } else if ((session->limQosEnabled) && sta_ptr->lleEnabled) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 927 | pe_debug("11e QoS Delts received"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 928 | } else if ((session->limWsmEnabled) && sta_ptr->wsmEnabled) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 929 | pe_debug("WSM Delts received"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 930 | } else { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 931 | pe_warn("Ignoring delts request: qos not enabled/capable"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 932 | return; |
| 933 | } |
| 934 | |
| 935 | tsinfo = delts.wmeTspecPresent ? &delts.tspec.tsinfo : &delts.tsinfo; |
| 936 | |
| 937 | /* if no Admit Control, ignore the request */ |
Srinivas Girigowda | f326dfe | 2017-08-03 11:28:32 -0700 | [diff] [blame] | 938 | if (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 939 | if (upToAc(tsinfo->traffic.userPrio) >= MAX_NUM_AC) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 940 | pe_warn("DelTs with UP: %d has no AC - ignoring req", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 941 | tsinfo->traffic.userPrio); |
| 942 | return; |
| 943 | } |
| 944 | } |
| 945 | |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 946 | if (!LIM_IS_AP_ROLE(session)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 947 | lim_send_sme_delts_ind(mac_ctx, &delts, aid, session); |
| 948 | |
| 949 | /* try to delete the TS */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 950 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 951 | lim_admit_control_delete_ts(mac_ctx, sta_ptr->assocId, tsinfo, |
| 952 | &ts_status, &tspec_idx)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 953 | pe_warn("Unable to Delete TS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 954 | return; |
| 955 | } else if (!((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) |
| 956 | || (tsinfo->traffic.accessPolicy == |
| 957 | SIR_MAC_ACCESSPOLICY_BOTH))){ |
| 958 | /* send message to HAL to delete TS */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 959 | if (QDF_STATUS_SUCCESS != lim_send_hal_msg_del_ts(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 960 | sta_ptr->staIndex, tspec_idx, |
| 961 | delts, session->peSessionId, |
| 962 | session->bssId)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 963 | pe_warn("DelTs with UP: %d failed ignoring request", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 964 | tsinfo->traffic.userPrio); |
| 965 | return; |
| 966 | } |
| 967 | } |
| 968 | /* |
| 969 | * We successfully deleted the TSPEC. Update the dynamic UAPSD Mask. |
| 970 | * The AC for this TSPEC is no longer trigger enabled if this Tspec |
| 971 | * was set-up in uplink direction only. |
| 972 | * The AC for this TSPEC is no longer delivery enabled if this Tspec |
| 973 | * was set-up in downlink direction only. |
| 974 | * The AC for this TSPEC is no longer triiger enabled and delivery |
| 975 | * enabled if this Tspec was a bidirectional TSPEC. |
| 976 | */ |
| 977 | lim_set_tspec_uapsd_mask_per_session(mac_ctx, session, |
| 978 | tsinfo, CLEAR_UAPSD_MASK); |
| 979 | /* |
| 980 | * We're deleting the TSPEC. |
| 981 | * The AC for this TSPEC is no longer admitted in uplink/downlink |
| 982 | * direction if this TSPEC was set-up in uplink/downlink direction only. |
| 983 | * The AC for this TSPEC is no longer admitted in both uplink and |
| 984 | * downlink directions if this TSPEC was a bi-directional TSPEC. |
| 985 | * If ACM is set for this AC and this AC is admitted only in downlink |
| 986 | * direction, PE needs to downgrade the EDCA parameter |
| 987 | * (for the AC for which TS is being deleted) to the |
| 988 | * next best AC for which ACM is not enabled, and send the |
| 989 | * updated values to HAL. |
| 990 | */ |
| 991 | ac = upToAc(tsinfo->traffic.userPrio); |
| 992 | if (tsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK) { |
| 993 | session->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= |
| 994 | ~(1 << ac); |
| 995 | } else if (tsinfo->traffic.direction == |
| 996 | SIR_MAC_DIRECTION_DNLINK) { |
| 997 | session->gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= |
| 998 | ~(1 << ac); |
| 999 | } else if (tsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR) { |
| 1000 | session->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= |
| 1001 | ~(1 << ac); |
| 1002 | session->gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= |
| 1003 | ~(1 << ac); |
| 1004 | } |
| 1005 | lim_set_active_edca_params(mac_ctx, session->gLimEdcaParams, |
| 1006 | session); |
| 1007 | sta_ds_ptr = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, |
| 1008 | &session->dph.dphHashTable); |
| 1009 | if (sta_ds_ptr != NULL) |
| 1010 | lim_send_edca_params(mac_ctx, session->gLimEdcaParamsActive, |
Kiran Kumar Lokere | 27026ae | 2018-03-09 11:38:19 -0800 | [diff] [blame] | 1011 | sta_ds_ptr->bssId, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1012 | else |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1013 | pe_err("Self entry missing in Hash Table"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1014 | |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1015 | pe_debug("DeleteTS succeeded"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1016 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1017 | lim_send_sme_tsm_ie_ind(mac_ctx, session, 0, 0, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1018 | #endif |
| 1019 | } |
| 1020 | |
| 1021 | /** |
| 1022 | * __lim_process_qos_map_configure_frame() - to process QoS map configure frame |
| 1023 | * @mac_ctx: pointer to mac context |
| 1024 | * @rx_pkt_info: pointer to received packet info |
| 1025 | * @session: pointer to session |
| 1026 | * |
| 1027 | * This routine will called to process qos map configure frame |
| 1028 | * |
| 1029 | * Return: none |
| 1030 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1031 | static void __lim_process_qos_map_configure_frame(struct mac_context *mac_ctx, |
Jeff Johnson | 41ce285 | 2018-11-19 06:51:22 -0800 | [diff] [blame] | 1032 | uint8_t *rx_pkt_info, struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1033 | { |
| 1034 | tpSirMacMgmtHdr mac_hdr; |
| 1035 | uint32_t frame_len; |
| 1036 | uint8_t *body_ptr; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1037 | QDF_STATUS retval; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 1038 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1039 | mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 1040 | body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 1041 | frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 1042 | retval = sir_convert_qos_map_configure_frame2_struct(mac_ctx, |
| 1043 | body_ptr, frame_len, &session->QosMapSet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1044 | if (retval != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1045 | pe_err("QosMapConfigure frame parsing fail %d", retval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1046 | return; |
| 1047 | } |
| 1048 | lim_send_sme_mgmt_frame_ind(mac_ctx, mac_hdr->fc.subType, |
| 1049 | (uint8_t *) mac_hdr, |
| 1050 | frame_len + sizeof(tSirMacMgmtHdr), 0, |
yeshwanth sriram guntuka | 2bc1435 | 2017-04-26 13:07:32 +0530 | [diff] [blame] | 1051 | WMA_GET_RX_CH(rx_pkt_info), session, |
| 1052 | WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1053 | } |
| 1054 | |
| 1055 | #ifdef ANI_SUPPORT_11H |
| 1056 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1057 | __lim_process_basic_meas_req(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1058 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1059 | tSirMacAddr peerMacAddr, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1060 | { |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1061 | if (lim_send_meas_report_frame(mac, pMeasReqFrame, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1062 | peerMacAddr, pe_session) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1063 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1064 | pe_err("fail to send Basic Meas report"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1065 | return; |
| 1066 | } |
| 1067 | } |
| 1068 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1069 | __lim_process_cca_meas_req(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1070 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1071 | tSirMacAddr peerMacAddr, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1072 | { |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1073 | if (lim_send_meas_report_frame(mac, pMeasReqFrame, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1074 | peerMacAddr, pe_session) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1075 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1076 | pe_err("fail to send CCA Meas report"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1077 | return; |
| 1078 | } |
| 1079 | } |
| 1080 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1081 | __lim_process_rpi_meas_req(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1082 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1083 | tSirMacAddr peerMacAddr, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1084 | { |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1085 | if (lim_send_meas_report_frame(mac, pMeasReqFrame, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1086 | peerMacAddr, pe_session) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1087 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1088 | pe_err("fail to send RPI Meas report"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1089 | return; |
| 1090 | } |
| 1091 | } |
| 1092 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1093 | __lim_process_measurement_request_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1094 | uint8_t *pRxPacketInfo, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1095 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1096 | { |
| 1097 | tpSirMacMgmtHdr pHdr; |
| 1098 | uint8_t *pBody; |
| 1099 | tpSirMacMeasReqActionFrame pMeasReqFrame; |
| 1100 | uint32_t frameLen; |
| 1101 | |
| 1102 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 1103 | pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 1104 | frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 1105 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1106 | pMeasReqFrame = qdf_mem_malloc(sizeof(tSirMacMeasReqActionFrame)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1107 | if (!pMeasReqFrame) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1108 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1109 | |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1110 | if (sir_convert_meas_req_frame2_struct(mac, pBody, pMeasReqFrame, frameLen) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1111 | != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1112 | pe_warn("Rcv invalid Measurement Request Action Frame"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1113 | return; |
| 1114 | } |
| 1115 | switch (pMeasReqFrame->measReqIE.measType) { |
| 1116 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1117 | __lim_process_basic_meas_req(mac, pMeasReqFrame, pHdr->sa, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1118 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1119 | break; |
| 1120 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1121 | __lim_process_cca_meas_req(mac, pMeasReqFrame, pHdr->sa, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1122 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1123 | break; |
| 1124 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1125 | __lim_process_rpi_meas_req(mac, pMeasReqFrame, pHdr->sa, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1126 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1127 | break; |
| 1128 | default: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1129 | pe_warn("Unknown Measurement Type: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1130 | pMeasReqFrame->measReqIE.measType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1131 | break; |
| 1132 | } |
| 1133 | } /*** end limProcessMeasurementRequestFrame ***/ |
| 1134 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1135 | __lim_process_tpc_request_frame(struct mac_context *mac, uint8_t *pRxPacketInfo, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1136 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1137 | { |
| 1138 | tpSirMacMgmtHdr pHdr; |
| 1139 | uint8_t *pBody; |
| 1140 | tpSirMacTpcReqActionFrame pTpcReqFrame; |
| 1141 | uint32_t frameLen; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 1142 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1143 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 1144 | pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 1145 | frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1146 | pe_debug("****LIM: Processing TPC Request from peer ****"); |
Nishank Aggarwal | 7f49419 | 2017-03-11 13:46:18 +0530 | [diff] [blame] | 1147 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1148 | pTpcReqFrame = qdf_mem_malloc(sizeof(tSirMacTpcReqActionFrame)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1149 | if (!pTpcReqFrame) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1150 | return; |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1151 | |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1152 | if (sir_convert_tpc_req_frame2_struct(mac, pBody, pTpcReqFrame, frameLen) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1153 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1154 | pe_warn("Rcv invalid TPC Req Action Frame"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1155 | return; |
| 1156 | } |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1157 | if (lim_send_tpc_report_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1158 | pTpcReqFrame, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1159 | pHdr->sa, pe_session) != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1160 | pe_err("fail to send TPC Report Frame"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1161 | return; |
| 1162 | } |
| 1163 | } |
| 1164 | #endif |
| 1165 | |
| 1166 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1167 | __lim_process_sm_power_save_update(struct mac_context *mac, uint8_t *pRxPacketInfo, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1168 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1169 | { |
| 1170 | |
| 1171 | tpSirMacMgmtHdr pHdr; |
| 1172 | tDot11fSMPowerSave frmSMPower; |
| 1173 | tSirMacHTMIMOPowerSaveState state; |
| 1174 | tpDphHashNode pSta; |
| 1175 | uint16_t aid; |
| 1176 | uint32_t frameLen, nStatus; |
| 1177 | uint8_t *pBody; |
| 1178 | |
| 1179 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 1180 | pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 1181 | frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 1182 | |
| 1183 | pSta = |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1184 | dph_lookup_hash_entry(mac, pHdr->sa, &aid, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1185 | &pe_session->dph.dphHashTable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1186 | if (pSta == NULL) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1187 | pe_err("STA context not found - ignoring UpdateSM PSave Mode from"); |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1188 | lim_print_mac_addr(mac, pHdr->sa, LOGE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1189 | return; |
| 1190 | } |
| 1191 | |
| 1192 | /**Unpack the received frame */ |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1193 | nStatus = dot11f_unpack_sm_power_save(mac, pBody, frameLen, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 1194 | &frmSMPower, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1195 | |
| 1196 | if (DOT11F_FAILED(nStatus)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1197 | pe_err("Failed to unpack and parse a Update SM Power (0x%08x, %d bytes):", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1198 | nStatus, frameLen); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 1199 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, |
| 1200 | pBody, frameLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1201 | return; |
| 1202 | } else if (DOT11F_WARNED(nStatus)) { |
Rajeev Kumar | b581380 | 2017-06-29 17:34:57 -0700 | [diff] [blame] | 1203 | pe_debug("There were warnings while unpacking a SMPower Save update (0x%08x, %d bytes):", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1204 | nStatus, frameLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1205 | } |
| 1206 | |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1207 | pe_debug("Received SM Power save Mode update Frame with PS_Enable: %d" |
| 1208 | "PS Mode: %d", frmSMPower.SMPowerModeSet.PowerSave_En, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1209 | frmSMPower.SMPowerModeSet.Mode); |
| 1210 | |
| 1211 | /** Update in the DPH Table about the Update in the SM Power Save mode*/ |
| 1212 | if (frmSMPower.SMPowerModeSet.PowerSave_En |
| 1213 | && frmSMPower.SMPowerModeSet.Mode) |
| 1214 | state = eSIR_HT_MIMO_PS_DYNAMIC; |
| 1215 | else if ((frmSMPower.SMPowerModeSet.PowerSave_En) |
| 1216 | && (frmSMPower.SMPowerModeSet.Mode == 0)) |
| 1217 | state = eSIR_HT_MIMO_PS_STATIC; |
| 1218 | else if ((frmSMPower.SMPowerModeSet.PowerSave_En == 0) |
| 1219 | && (frmSMPower.SMPowerModeSet.Mode == 0)) |
| 1220 | state = eSIR_HT_MIMO_PS_NO_LIMIT; |
| 1221 | else { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1222 | pe_warn("Received SM Power save Mode update Frame with invalid mode"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1223 | return; |
| 1224 | } |
| 1225 | |
| 1226 | if (state == pSta->htMIMOPSState) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1227 | pe_err("The PEER is already set in the same mode"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1228 | return; |
| 1229 | } |
| 1230 | |
| 1231 | /** Update in the HAL Station Table for the Update of the Protection Mode */ |
| 1232 | pSta->htMIMOPSState = state; |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1233 | lim_post_sm_state_update(mac, pSta->staIndex, pSta->htMIMOPSState, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1234 | pSta->staAddr, pe_session->smeSessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1235 | } |
| 1236 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1237 | |
| 1238 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1239 | __lim_process_radio_measure_request(struct mac_context *mac, uint8_t *pRxPacketInfo, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1240 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1241 | { |
| 1242 | tpSirMacMgmtHdr pHdr; |
Mohit Khanna | 841044f | 2016-03-25 16:16:24 -0700 | [diff] [blame] | 1243 | tDot11fRadioMeasurementRequest *frm; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1244 | uint32_t frameLen, nStatus; |
| 1245 | uint8_t *pBody; |
Abhinav Kumar | fcc22e0 | 2018-03-23 16:46:06 +0530 | [diff] [blame] | 1246 | uint16_t curr_seq_num; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1247 | |
| 1248 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 1249 | pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 1250 | frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 1251 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1252 | if (pe_session == NULL) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1253 | return; |
| 1254 | } |
| 1255 | |
Abhinav Kumar | fcc22e0 | 2018-03-23 16:46:06 +0530 | [diff] [blame] | 1256 | curr_seq_num = ((pHdr->seqControl.seqNumHi << |
| 1257 | HIGH_SEQ_NUM_OFFSET) | |
| 1258 | pHdr->seqControl.seqNumLo); |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1259 | if (curr_seq_num == mac->rrm.rrmPEContext.prev_rrm_report_seq_num && |
| 1260 | mac->rrm.rrmPEContext.pCurrentReq) { |
Abhinav Kumar | fcc22e0 | 2018-03-23 16:46:06 +0530 | [diff] [blame] | 1261 | pe_err("rrm report req frame, seq num: %d is already in progress, drop it", |
| 1262 | curr_seq_num); |
| 1263 | return; |
| 1264 | } |
| 1265 | /* Save seq no of currently processing rrm report req frame */ |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1266 | mac->rrm.rrmPEContext.prev_rrm_report_seq_num = curr_seq_num; |
| 1267 | lim_send_sme_mgmt_frame_ind(mac, pHdr->fc.subType, (uint8_t *)pHdr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1268 | frameLen + sizeof(tSirMacMgmtHdr), 0, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1269 | WMA_GET_RX_CH(pRxPacketInfo), pe_session, |
yeshwanth sriram guntuka | 2bc1435 | 2017-04-26 13:07:32 +0530 | [diff] [blame] | 1270 | WMA_GET_RX_RSSI_NORMALIZED(pRxPacketInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1271 | |
Mohit Khanna | 841044f | 2016-03-25 16:16:24 -0700 | [diff] [blame] | 1272 | frm = qdf_mem_malloc(sizeof(*frm)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1273 | if (!frm) |
Mohit Khanna | 841044f | 2016-03-25 16:16:24 -0700 | [diff] [blame] | 1274 | return; |
Mohit Khanna | 841044f | 2016-03-25 16:16:24 -0700 | [diff] [blame] | 1275 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1276 | /**Unpack the received frame */ |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1277 | nStatus = dot11f_unpack_radio_measurement_request(mac, pBody, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 1278 | frameLen, frm, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1279 | |
| 1280 | if (DOT11F_FAILED(nStatus)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1281 | pe_err("Failed to unpack and parse a Radio Measure request (0x%08x, %d bytes):", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1282 | nStatus, frameLen); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 1283 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, |
| 1284 | pBody, frameLen); |
Srinivas Girigowda | eff16d9 | 2018-09-12 14:56:29 -0700 | [diff] [blame] | 1285 | goto err; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1286 | } else if (DOT11F_WARNED(nStatus)) { |
Rajeev Kumar | b581380 | 2017-06-29 17:34:57 -0700 | [diff] [blame] | 1287 | pe_debug("There were warnings while unpacking a Radio Measure request (0x%08x, %d bytes):", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1288 | nStatus, frameLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1289 | } |
| 1290 | /* Call rrm function to handle the request. */ |
| 1291 | |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1292 | rrm_process_radio_measurement_request(mac, pHdr->sa, frm, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1293 | pe_session); |
Mohit Khanna | 841044f | 2016-03-25 16:16:24 -0700 | [diff] [blame] | 1294 | err: |
| 1295 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1296 | } |
| 1297 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1298 | static QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1299 | __lim_process_link_measurement_req(struct mac_context *mac, uint8_t *pRxPacketInfo, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1300 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1301 | { |
| 1302 | tpSirMacMgmtHdr pHdr; |
| 1303 | tDot11fLinkMeasurementRequest frm; |
| 1304 | uint32_t frameLen, nStatus; |
| 1305 | uint8_t *pBody; |
| 1306 | |
| 1307 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 1308 | pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 1309 | frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 1310 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1311 | if (pe_session == NULL) { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1312 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1313 | } |
| 1314 | |
| 1315 | /**Unpack the received frame */ |
| 1316 | nStatus = |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1317 | dot11f_unpack_link_measurement_request(mac, pBody, frameLen, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 1318 | &frm, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1319 | |
| 1320 | if (DOT11F_FAILED(nStatus)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1321 | pe_err("Failed to unpack and parse a Link Measure request (0x%08x, %d bytes):", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1322 | nStatus, frameLen); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 1323 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, |
| 1324 | pBody, frameLen); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1325 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1326 | } else if (DOT11F_WARNED(nStatus)) { |
Rajeev Kumar | b581380 | 2017-06-29 17:34:57 -0700 | [diff] [blame] | 1327 | pe_debug("There were warnings while unpacking a Link Measure request (0x%08x, %d bytes):", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1328 | nStatus, frameLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1329 | } |
| 1330 | /* Call rrm function to handle the request. */ |
| 1331 | |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1332 | return rrm_process_link_measurement_request(mac, pRxPacketInfo, &frm, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1333 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1334 | |
| 1335 | } |
| 1336 | |
| 1337 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1338 | __lim_process_neighbor_report(struct mac_context *mac, uint8_t *pRxPacketInfo, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1339 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1340 | { |
| 1341 | tpSirMacMgmtHdr pHdr; |
| 1342 | tDot11fNeighborReportResponse *pFrm; |
| 1343 | uint32_t frameLen, nStatus; |
| 1344 | uint8_t *pBody; |
| 1345 | |
| 1346 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 1347 | pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 1348 | frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 1349 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1350 | pFrm = qdf_mem_malloc(sizeof(tDot11fNeighborReportResponse)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1351 | if (!pFrm) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1352 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1353 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1354 | if (pe_session == NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1355 | qdf_mem_free(pFrm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1356 | return; |
| 1357 | } |
| 1358 | |
| 1359 | /**Unpack the received frame */ |
| 1360 | nStatus = |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1361 | dot11f_unpack_neighbor_report_response(mac, pBody, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 1362 | frameLen, pFrm, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1363 | |
| 1364 | if (DOT11F_FAILED(nStatus)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1365 | pe_err("Failed to unpack and parse a Neighbor report response (0x%08x, %d bytes):", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1366 | nStatus, frameLen); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 1367 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, |
| 1368 | pBody, frameLen); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1369 | qdf_mem_free(pFrm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1370 | return; |
| 1371 | } else if (DOT11F_WARNED(nStatus)) { |
Rajeev Kumar | b581380 | 2017-06-29 17:34:57 -0700 | [diff] [blame] | 1372 | pe_debug("There were warnings while unpacking a Neighbor report response (0x%08x, %d bytes):", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1373 | nStatus, frameLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1374 | } |
| 1375 | /* Call rrm function to handle the request. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1376 | rrm_process_neighbor_report_response(mac, pFrm, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1377 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1378 | qdf_mem_free(pFrm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1379 | } |
| 1380 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1381 | |
| 1382 | #ifdef WLAN_FEATURE_11W |
| 1383 | /** |
| 1384 | * limProcessSAQueryRequestActionFrame |
| 1385 | * |
| 1386 | ***FUNCTION: |
| 1387 | * This function is called by lim_process_action_frame() upon |
| 1388 | * SA query request Action frame reception. |
| 1389 | * |
| 1390 | ***LOGIC: |
| 1391 | * |
| 1392 | ***ASSUMPTIONS: |
| 1393 | * |
| 1394 | ***NOTE: |
| 1395 | * |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1396 | * @param mac - Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1397 | * @param *pRxPacketInfo - Handle to the Rx packet info |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1398 | * @param pe_session - PE session entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1399 | * |
| 1400 | * @return None |
| 1401 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1402 | static void __lim_process_sa_query_request_action_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1403 | uint8_t *pRxPacketInfo, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1404 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1405 | { |
| 1406 | tpSirMacMgmtHdr pHdr; |
| 1407 | uint8_t *pBody; |
Jianmin Zhu | 2f708f2 | 2018-07-23 22:07:05 +0800 | [diff] [blame] | 1408 | uint32_t frame_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1409 | uint8_t transId[2]; |
| 1410 | |
| 1411 | /* Prima --- Below Macro not available in prima |
| 1412 | pHdr = SIR_MAC_BD_TO_MPDUHEADER(pBd); |
| 1413 | pBody = SIR_MAC_BD_TO_MPDUDATA(pBd); */ |
| 1414 | |
| 1415 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 1416 | pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo); |
Jianmin Zhu | 2f708f2 | 2018-07-23 22:07:05 +0800 | [diff] [blame] | 1417 | frame_len = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1418 | |
Jianmin Zhu | 2f708f2 | 2018-07-23 22:07:05 +0800 | [diff] [blame] | 1419 | if (frame_len < sizeof(struct sDot11fSaQueryReq)) { |
| 1420 | pe_err("Invalid frame length"); |
| 1421 | return; |
| 1422 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1423 | /* If this is an unprotected SA Query Request, then ignore it. */ |
| 1424 | if (pHdr->fc.wep == 0) |
| 1425 | return; |
| 1426 | |
mukul sharma | 72c8b22 | 2015-09-04 17:02:01 +0530 | [diff] [blame] | 1427 | /* 11w offload is enabled then firmware should not fwd this frame */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1428 | if (LIM_IS_STA_ROLE(pe_session) && mac->pmf_offload) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1429 | pe_err("11w offload enabled, SA Query req isn't expected"); |
mukul sharma | 72c8b22 | 2015-09-04 17:02:01 +0530 | [diff] [blame] | 1430 | return; |
| 1431 | } |
| 1432 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1433 | /*Extract 11w trsansId from SA query request action frame |
| 1434 | In SA query response action frame we will send same transId |
| 1435 | In SA query request action frame: |
| 1436 | Category : 1 byte |
| 1437 | Action : 1 byte |
| 1438 | Transaction ID : 2 bytes */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1439 | qdf_mem_copy(&transId[0], &pBody[2], 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1440 | |
| 1441 | /* Send 11w SA query response action frame */ |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1442 | if (lim_send_sa_query_response_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1443 | transId, |
| 1444 | pHdr->sa, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1445 | pe_session) != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1446 | pe_err("fail to send SA query response action frame"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1447 | return; |
| 1448 | } |
| 1449 | } |
| 1450 | |
| 1451 | /** |
| 1452 | * __lim_process_sa_query_response_action_frame |
| 1453 | * |
| 1454 | ***FUNCTION: |
| 1455 | * This function is called by lim_process_action_frame() upon |
| 1456 | * SA query response Action frame reception. |
| 1457 | * |
| 1458 | ***LOGIC: |
| 1459 | * |
| 1460 | ***ASSUMPTIONS: |
| 1461 | * |
| 1462 | ***NOTE: |
| 1463 | * |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1464 | * @param mac - Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1465 | * @param *pRxPacketInfo - Handle to the Rx packet info |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1466 | * @param pe_session - PE session entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1467 | * @return None |
| 1468 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1469 | static void __lim_process_sa_query_response_action_frame(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1470 | uint8_t *pRxPacketInfo, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1471 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1472 | { |
| 1473 | tpSirMacMgmtHdr pHdr; |
Jianmin Zhu | 2f708f2 | 2018-07-23 22:07:05 +0800 | [diff] [blame] | 1474 | uint32_t frame_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1475 | uint8_t *pBody; |
| 1476 | tpDphHashNode pSta; |
| 1477 | uint16_t aid; |
| 1478 | uint16_t transId; |
| 1479 | uint8_t retryNum; |
| 1480 | |
| 1481 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
Jianmin Zhu | 2f708f2 | 2018-07-23 22:07:05 +0800 | [diff] [blame] | 1482 | frame_len = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1483 | pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo); |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1484 | pe_debug("SA Query Response received"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1485 | |
Jianmin Zhu | 2f708f2 | 2018-07-23 22:07:05 +0800 | [diff] [blame] | 1486 | if (frame_len < sizeof(struct sDot11fSaQueryRsp)) { |
| 1487 | pe_err("Invalid frame length"); |
| 1488 | return; |
| 1489 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1490 | /* When a station, supplicant handles SA Query Response. |
| 1491 | * Forward to SME to HDD to wpa_supplicant. |
| 1492 | */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1493 | if (LIM_IS_STA_ROLE(pe_session)) { |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1494 | lim_send_sme_mgmt_frame_ind(mac, pHdr->fc.subType, |
Jianmin Zhu | 2f708f2 | 2018-07-23 22:07:05 +0800 | [diff] [blame] | 1495 | (uint8_t *)pHdr, |
| 1496 | frame_len + sizeof(tSirMacMgmtHdr), |
| 1497 | 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1498 | WMA_GET_RX_CH(pRxPacketInfo), |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1499 | pe_session, |
yeshwanth sriram guntuka | 2bc1435 | 2017-04-26 13:07:32 +0530 | [diff] [blame] | 1500 | WMA_GET_RX_RSSI_NORMALIZED( |
| 1501 | pRxPacketInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1502 | return; |
| 1503 | } |
| 1504 | |
| 1505 | /* If this is an unprotected SA Query Response, then ignore it. */ |
| 1506 | if (pHdr->fc.wep == 0) |
| 1507 | return; |
| 1508 | |
| 1509 | pSta = |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1510 | dph_lookup_hash_entry(mac, pHdr->sa, &aid, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1511 | &pe_session->dph.dphHashTable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1512 | if (NULL == pSta) |
| 1513 | return; |
| 1514 | |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1515 | pe_debug("SA Query Response source addr: %0x:%0x:%0x:%0x:%0x:%0x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1516 | pHdr->sa[0], pHdr->sa[1], pHdr->sa[2], pHdr->sa[3], |
| 1517 | pHdr->sa[4], pHdr->sa[5]); |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1518 | pe_debug("SA Query state for station: %d", pSta->pmfSaQueryState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1519 | |
| 1520 | if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState) |
| 1521 | return; |
| 1522 | |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 1523 | /* Extract 11w trsansId from SA query response action frame |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1524 | In SA query response action frame: |
| 1525 | Category : 1 byte |
| 1526 | Action : 1 byte |
| 1527 | Transaction ID : 2 bytes */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1528 | qdf_mem_copy(&transId, &pBody[2], 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1529 | |
| 1530 | /* If SA Query is in progress with the station and the station |
| 1531 | responds then the association request that triggered the SA |
| 1532 | query is from a rogue station, just go back to initial state. */ |
| 1533 | for (retryNum = 0; retryNum <= pSta->pmfSaQueryRetryCount; retryNum++) |
| 1534 | if (transId == pSta->pmfSaQueryStartTransId + retryNum) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1535 | pe_debug("Found matching SA Query Request - transaction ID: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1536 | transId); |
| 1537 | tx_timer_deactivate(&pSta->pmfSaQueryTimer); |
| 1538 | pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS; |
| 1539 | break; |
| 1540 | } |
| 1541 | } |
| 1542 | #endif |
| 1543 | |
| 1544 | #ifdef WLAN_FEATURE_11W |
| 1545 | /** |
| 1546 | * lim_drop_unprotected_action_frame |
| 1547 | * |
| 1548 | ***FUNCTION: |
| 1549 | * This function checks if an Action frame should be dropped since it is |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 1550 | * a Robust Management Frame, it is unprotected, and it is received on a |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1551 | * connection where PMF is enabled. |
| 1552 | * |
| 1553 | ***LOGIC: |
| 1554 | * |
| 1555 | ***ASSUMPTIONS: |
| 1556 | * |
| 1557 | ***NOTE: |
| 1558 | * |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1559 | * @param mac - Global MAC structure |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1560 | * @param pe_session - PE session entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1561 | * @param pHdr - Frame header |
| 1562 | * @param category - Action frame category |
| 1563 | * @return true if frame should be dropped |
| 1564 | */ |
| 1565 | |
| 1566 | static bool |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1567 | lim_drop_unprotected_action_frame(struct mac_context *mac, struct pe_session *pe_session, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1568 | tpSirMacMgmtHdr pHdr, uint8_t category) |
| 1569 | { |
| 1570 | uint16_t aid; |
| 1571 | tpDphHashNode pStaDs; |
| 1572 | bool rmfConnection = false; |
| 1573 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1574 | if (LIM_IS_AP_ROLE(pe_session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1575 | pStaDs = |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 1576 | dph_lookup_hash_entry(mac, pHdr->sa, &aid, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1577 | &pe_session->dph.dphHashTable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1578 | if (pStaDs != NULL) |
| 1579 | if (pStaDs->rmfEnabled) |
| 1580 | rmfConnection = true; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1581 | } else if (pe_session->limRmfEnabled) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1582 | rmfConnection = true; |
| 1583 | |
| 1584 | if (rmfConnection && (pHdr->fc.wep == 0)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1585 | pe_err("Dropping unprotected Action category: %d frame since RMF is enabled", |
| 1586 | category); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1587 | return true; |
| 1588 | } else |
| 1589 | return false; |
| 1590 | } |
| 1591 | #endif |
| 1592 | |
| 1593 | /** |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1594 | * lim_process_addba_req() - process ADDBA Request |
| 1595 | * @mac_ctx: Pointer to Global MAC structure |
| 1596 | * @rx_pkt_info: A pointer to packet info structure |
| 1597 | * @session: PE session pointer |
| 1598 | * |
| 1599 | * This routine will be called to process ADDBA request action frame |
| 1600 | * |
| 1601 | * Return: None |
| 1602 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1603 | static void lim_process_addba_req(struct mac_context *mac_ctx, uint8_t *rx_pkt_info, |
Jeff Johnson | 41ce285 | 2018-11-19 06:51:22 -0800 | [diff] [blame] | 1604 | struct pe_session *session) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1605 | { |
| 1606 | tpSirMacMgmtHdr mac_hdr; |
| 1607 | uint8_t *body_ptr; |
| 1608 | tDot11faddba_req *addba_req; |
| 1609 | uint32_t frame_len, status; |
| 1610 | QDF_STATUS qdf_status; |
| 1611 | uint8_t peer_id; |
| 1612 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1613 | void *peer, *pdev; |
| 1614 | |
| 1615 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 1616 | if (!pdev) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1617 | pe_err("pdev is NULL"); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1618 | return; |
| 1619 | } |
| 1620 | |
| 1621 | mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 1622 | body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 1623 | frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 1624 | |
| 1625 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO, |
| 1626 | body_ptr, frame_len); |
| 1627 | |
| 1628 | addba_req = qdf_mem_malloc(sizeof(*addba_req)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1629 | if (!addba_req) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1630 | return; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1631 | |
| 1632 | /* Unpack ADDBA request frame */ |
| 1633 | status = dot11f_unpack_addba_req(mac_ctx, body_ptr, frame_len, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 1634 | addba_req, false); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1635 | |
| 1636 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1637 | pe_err("Failed to unpack and parse (0x%08x, %d bytes)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1638 | status, frame_len); |
| 1639 | goto error; |
| 1640 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1641 | pe_warn("warning: unpack addba Req(0x%08x, %d bytes)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1642 | status, frame_len); |
| 1643 | } |
| 1644 | |
Mohit Khanna | c4c2225 | 2017-11-20 11:06:33 -0800 | [diff] [blame] | 1645 | peer = cdp_peer_get_ref_by_addr(soc, pdev, mac_hdr->sa, &peer_id, |
| 1646 | PEER_DEBUG_ID_WMA_ADDBA_REQ); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1647 | if (!peer) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1648 | pe_err("PEER [%pM] not found", mac_hdr->sa); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1649 | goto error; |
| 1650 | } |
| 1651 | |
| 1652 | qdf_status = cdp_addba_requestprocess(soc, peer, |
| 1653 | addba_req->DialogToken.token, |
| 1654 | addba_req->addba_param_set.tid, |
| 1655 | addba_req->ba_timeout.timeout, |
| 1656 | addba_req->addba_param_set.buff_size, |
| 1657 | addba_req->ba_start_seq_ctrl.ssn); |
| 1658 | |
Mohit Khanna | c4c2225 | 2017-11-20 11:06:33 -0800 | [diff] [blame] | 1659 | cdp_peer_release_ref(soc, peer, PEER_DEBUG_ID_WMA_ADDBA_REQ); |
| 1660 | |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1661 | if (QDF_STATUS_SUCCESS == qdf_status) { |
| 1662 | lim_send_addba_response_frame(mac_ctx, mac_hdr->sa, |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 1663 | addba_req->addba_param_set.tid, session, |
Kiran Kumar Lokere | aee823a | 2018-03-22 15:27:05 -0700 | [diff] [blame] | 1664 | addba_req->addba_extn_element.present, |
| 1665 | addba_req->addba_param_set.amsdu_supp); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1666 | } else { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1667 | pe_err("Failed to process addba request"); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1668 | } |
| 1669 | |
| 1670 | error: |
| 1671 | qdf_mem_free(addba_req); |
| 1672 | return; |
| 1673 | } |
| 1674 | |
| 1675 | /** |
| 1676 | * lim_process_delba_req() - process DELBA Request |
| 1677 | * @mac_ctx: Pointer to Global MAC structure |
| 1678 | * @rx_pkt_info: A pointer to packet info structure |
| 1679 | * @session: PE session pointer |
| 1680 | * |
| 1681 | * This routine will be called to process ADDBA request action frame |
| 1682 | * |
| 1683 | * Return: None |
| 1684 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1685 | static void lim_process_delba_req(struct mac_context *mac_ctx, uint8_t *rx_pkt_info, |
Jeff Johnson | 41ce285 | 2018-11-19 06:51:22 -0800 | [diff] [blame] | 1686 | struct pe_session *session) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1687 | { |
| 1688 | tpSirMacMgmtHdr mac_hdr; |
| 1689 | uint8_t *body_ptr; |
| 1690 | tDot11fdelba_req *delba_req; |
| 1691 | uint32_t frame_len, status; |
| 1692 | QDF_STATUS qdf_status; |
| 1693 | uint8_t peer_id; |
| 1694 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1695 | void *peer, *pdev; |
| 1696 | |
| 1697 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 1698 | if (!pdev) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1699 | pe_err("pdev is NULL"); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1700 | return; |
| 1701 | } |
| 1702 | |
| 1703 | mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 1704 | body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 1705 | frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 1706 | |
| 1707 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO, |
| 1708 | body_ptr, frame_len); |
| 1709 | |
| 1710 | delba_req = qdf_mem_malloc(sizeof(*delba_req)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1711 | if (!delba_req) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1712 | return; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1713 | |
| 1714 | /* Unpack DELBA request frame */ |
| 1715 | status = dot11f_unpack_delba_req(mac_ctx, body_ptr, frame_len, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 1716 | delba_req, false); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1717 | |
| 1718 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1719 | pe_err("Failed to unpack and parse (0x%08x, %d bytes)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1720 | status, frame_len); |
| 1721 | goto error; |
| 1722 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1723 | pe_warn("warning: unpack addba Req(0x%08x, %d bytes)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1724 | status, frame_len); |
| 1725 | } |
| 1726 | |
Mohit Khanna | c4c2225 | 2017-11-20 11:06:33 -0800 | [diff] [blame] | 1727 | peer = cdp_peer_get_ref_by_addr(soc, pdev, mac_hdr->sa, &peer_id, |
| 1728 | PEER_DEBUG_ID_WMA_DELBA_REQ); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1729 | if (!peer) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1730 | pe_err("PEER [%pM] not found", mac_hdr->sa); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1731 | goto error; |
| 1732 | } |
| 1733 | |
| 1734 | qdf_status = cdp_delba_process(soc, peer, |
| 1735 | delba_req->delba_param_set.tid, delba_req->Reason.code); |
| 1736 | |
Mohit Khanna | c4c2225 | 2017-11-20 11:06:33 -0800 | [diff] [blame] | 1737 | cdp_peer_release_ref(soc, peer, PEER_DEBUG_ID_WMA_DELBA_REQ); |
| 1738 | |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1739 | if (QDF_STATUS_SUCCESS != qdf_status) |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1740 | pe_err("Failed to process delba request"); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 1741 | |
| 1742 | error: |
| 1743 | qdf_mem_free(delba_req); |
| 1744 | return; |
| 1745 | } |
| 1746 | |
| 1747 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1748 | * lim_process_action_frame() - to process action frames |
| 1749 | * @mac_ctx: Pointer to Global MAC structure |
| 1750 | * @rx_pkt_info: A pointer to packet info structure |
| 1751 | * |
| 1752 | * This function is called by limProcessMessageQueue() upon |
| 1753 | * Action frame reception. |
| 1754 | * |
| 1755 | * Return: none |
| 1756 | */ |
| 1757 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 1758 | void lim_process_action_frame(struct mac_context *mac_ctx, |
Jeff Johnson | 41ce285 | 2018-11-19 06:51:22 -0800 | [diff] [blame] | 1759 | uint8_t *rx_pkt_info, struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1760 | { |
| 1761 | uint8_t *body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 1762 | tpSirMacActionFrameHdr action_hdr = (tpSirMacActionFrameHdr) body_ptr; |
| 1763 | #ifdef WLAN_FEATURE_11W |
| 1764 | tpSirMacMgmtHdr mac_hdr_11w = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 1765 | #endif |
| 1766 | tpSirMacMgmtHdr mac_hdr = NULL; |
| 1767 | int8_t rssi; |
Vignesh Viswanathan | 5f37b21 | 2018-06-07 16:15:56 +0530 | [diff] [blame] | 1768 | uint32_t frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1769 | tpSirMacVendorSpecificFrameHdr vendor_specific; |
| 1770 | uint8_t oui[] = { 0x00, 0x00, 0xf0 }; |
Vignesh Viswanathan | eaa6889 | 2017-09-27 12:16:34 +0530 | [diff] [blame] | 1771 | uint8_t dpp_oui[] = { 0x50, 0x6F, 0x9A, 0x1A }; |
Vignesh Viswanathan | 5f37b21 | 2018-06-07 16:15:56 +0530 | [diff] [blame] | 1772 | tpSirMacVendorSpecificPublicActionFrameHdr pub_action; |
| 1773 | |
| 1774 | if (frame_len < sizeof(*action_hdr)) { |
| 1775 | pe_debug("frame_len %d less than Action Frame Hdr size", |
| 1776 | frame_len); |
| 1777 | return; |
| 1778 | } |
| 1779 | |
Rajeev Kumar | 0320080 | 2016-04-15 13:59:36 -0700 | [diff] [blame] | 1780 | #ifdef WLAN_FEATURE_11W |
| 1781 | if (lim_is_robust_mgmt_action_frame(action_hdr->category) && |
| 1782 | lim_drop_unprotected_action_frame(mac_ctx, session, |
| 1783 | mac_hdr_11w, action_hdr->category)) |
| 1784 | return; |
| 1785 | #endif |
| 1786 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1787 | switch (action_hdr->category) { |
| 1788 | case SIR_MAC_ACTION_QOS_MGMT: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1789 | if ((session->limQosEnabled) || |
| 1790 | (action_hdr->actionID == SIR_MAC_QOS_MAP_CONFIGURE)) { |
| 1791 | switch (action_hdr->actionID) { |
| 1792 | case SIR_MAC_QOS_ADD_TS_REQ: |
| 1793 | __lim_process_add_ts_req(mac_ctx, |
| 1794 | (uint8_t *) rx_pkt_info, |
| 1795 | session); |
| 1796 | break; |
| 1797 | |
| 1798 | case SIR_MAC_QOS_ADD_TS_RSP: |
| 1799 | __lim_process_add_ts_rsp(mac_ctx, |
| 1800 | (uint8_t *) rx_pkt_info, |
| 1801 | session); |
| 1802 | break; |
| 1803 | |
| 1804 | case SIR_MAC_QOS_DEL_TS_REQ: |
| 1805 | __lim_process_del_ts_req(mac_ctx, |
| 1806 | (uint8_t *) rx_pkt_info, |
| 1807 | session); |
| 1808 | break; |
| 1809 | |
| 1810 | case SIR_MAC_QOS_MAP_CONFIGURE: |
| 1811 | __lim_process_qos_map_configure_frame(mac_ctx, |
| 1812 | (uint8_t *)rx_pkt_info, |
| 1813 | session); |
| 1814 | break; |
| 1815 | default: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1816 | pe_warn("Qos action: %d not handled", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1817 | action_hdr->actionID); |
| 1818 | break; |
| 1819 | } |
| 1820 | break; |
| 1821 | } |
| 1822 | break; |
| 1823 | |
| 1824 | case SIR_MAC_ACTION_SPECTRUM_MGMT: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1825 | switch (action_hdr->actionID) { |
| 1826 | #ifdef ANI_SUPPORT_11H |
| 1827 | case SIR_MAC_ACTION_MEASURE_REQUEST_ID: |
| 1828 | if (session->lim11hEnable) |
| 1829 | __lim_process_measurement_request_frame(mac_ctx, |
| 1830 | rx_pkt_info, |
| 1831 | session); |
| 1832 | break; |
| 1833 | case SIR_MAC_ACTION_TPC_REQUEST_ID: |
| 1834 | if ((LIM_IS_STA_ROLE(session) || |
| 1835 | LIM_IS_AP_ROLE(session)) && |
| 1836 | session->lim11hEnable) |
| 1837 | __lim_process_tpc_request_frame(mac_ctx, |
| 1838 | rx_pkt_info, session); |
| 1839 | break; |
| 1840 | #endif |
| 1841 | case SIR_MAC_ACTION_CHANNEL_SWITCH_ID: |
| 1842 | if (LIM_IS_STA_ROLE(session)) |
| 1843 | __lim_process_channel_switch_action_frame( |
| 1844 | mac_ctx, rx_pkt_info, session); |
| 1845 | break; |
| 1846 | default: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1847 | pe_warn("Spectrum mgmt action id: %d not handled", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1848 | action_hdr->actionID); |
| 1849 | break; |
| 1850 | } |
| 1851 | break; |
| 1852 | |
| 1853 | case SIR_MAC_ACTION_WME: |
| 1854 | if (!session->limWmeEnabled) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1855 | pe_warn("WME mode disabled - dropping frame: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1856 | action_hdr->actionID); |
| 1857 | break; |
| 1858 | } |
| 1859 | switch (action_hdr->actionID) { |
| 1860 | case SIR_MAC_QOS_ADD_TS_REQ: |
| 1861 | __lim_process_add_ts_req(mac_ctx, |
| 1862 | (uint8_t *) rx_pkt_info, session); |
| 1863 | break; |
| 1864 | |
| 1865 | case SIR_MAC_QOS_ADD_TS_RSP: |
| 1866 | __lim_process_add_ts_rsp(mac_ctx, |
| 1867 | (uint8_t *) rx_pkt_info, session); |
| 1868 | break; |
| 1869 | |
| 1870 | case SIR_MAC_QOS_DEL_TS_REQ: |
| 1871 | __lim_process_del_ts_req(mac_ctx, |
| 1872 | (uint8_t *) rx_pkt_info, session); |
| 1873 | break; |
| 1874 | |
| 1875 | case SIR_MAC_QOS_MAP_CONFIGURE: |
| 1876 | __lim_process_qos_map_configure_frame(mac_ctx, |
| 1877 | (uint8_t *)rx_pkt_info, session); |
| 1878 | break; |
| 1879 | |
| 1880 | default: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1881 | pe_warn("WME action: %d not handled", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1882 | action_hdr->actionID); |
| 1883 | break; |
| 1884 | } |
| 1885 | break; |
| 1886 | |
| 1887 | case SIR_MAC_ACTION_HT: |
| 1888 | /** Type of HT Action to be performed*/ |
| 1889 | switch (action_hdr->actionID) { |
| 1890 | case SIR_MAC_SM_POWER_SAVE: |
| 1891 | if (LIM_IS_AP_ROLE(session)) |
| 1892 | __lim_process_sm_power_save_update(mac_ctx, |
| 1893 | (uint8_t *)rx_pkt_info, |
| 1894 | session); |
| 1895 | break; |
| 1896 | default: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1897 | pe_warn("Action ID: %d not handled in HT category", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1898 | action_hdr->actionID); |
| 1899 | break; |
| 1900 | } |
| 1901 | break; |
| 1902 | |
| 1903 | case SIR_MAC_ACTION_WNM: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1904 | pe_debug("WNM Action category: %d action: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1905 | action_hdr->category, action_hdr->actionID); |
| 1906 | switch (action_hdr->actionID) { |
| 1907 | case SIR_MAC_WNM_BSS_TM_QUERY: |
| 1908 | case SIR_MAC_WNM_BSS_TM_REQUEST: |
| 1909 | case SIR_MAC_WNM_BSS_TM_RESPONSE: |
| 1910 | case SIR_MAC_WNM_NOTIF_REQUEST: |
| 1911 | case SIR_MAC_WNM_NOTIF_RESPONSE: |
Deepak Dhamdhere | 68929ec | 2015-08-05 15:16:35 -0700 | [diff] [blame] | 1912 | rssi = WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1913 | mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 1914 | /* Forward to the SME to HDD to wpa_supplicant */ |
| 1915 | lim_send_sme_mgmt_frame_ind(mac_ctx, |
| 1916 | mac_hdr->fc.subType, |
| 1917 | (uint8_t *) mac_hdr, |
| 1918 | frame_len + sizeof(tSirMacMgmtHdr), |
| 1919 | session->smeSessionId, |
| 1920 | WMA_GET_RX_CH(rx_pkt_info), |
| 1921 | session, rssi); |
| 1922 | break; |
| 1923 | default: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1924 | pe_debug("Action ID: %d not handled in WNM category", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1925 | action_hdr->actionID); |
| 1926 | break; |
| 1927 | } |
| 1928 | break; |
| 1929 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1930 | case SIR_MAC_ACTION_RRM: |
Abhishek Singh | ca40803 | 2016-09-13 15:26:12 +0530 | [diff] [blame] | 1931 | /* Ignore RRM measurement request until DHCP is set */ |
| 1932 | if (mac_ctx->rrm.rrmPEContext.rrmEnable && |
| 1933 | mac_ctx->roam.roamSession |
| 1934 | [session->smeSessionId].dhcp_done) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1935 | switch (action_hdr->actionID) { |
| 1936 | case SIR_MAC_RRM_RADIO_MEASURE_REQ: |
| 1937 | __lim_process_radio_measure_request(mac_ctx, |
| 1938 | (uint8_t *)rx_pkt_info, |
| 1939 | session); |
| 1940 | break; |
| 1941 | case SIR_MAC_RRM_LINK_MEASUREMENT_REQ: |
Arif Hussain | 776ee7a | 2016-11-10 20:28:50 -0800 | [diff] [blame] | 1942 | if (!lim_is_valid_frame( |
| 1943 | &rrm_link_action_frm, |
| 1944 | rx_pkt_info)) |
| 1945 | break; |
| 1946 | |
| 1947 | if (__lim_process_link_measurement_req( |
| 1948 | mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1949 | (uint8_t *)rx_pkt_info, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1950 | session) == QDF_STATUS_SUCCESS) |
Arif Hussain | 776ee7a | 2016-11-10 20:28:50 -0800 | [diff] [blame] | 1951 | lim_update_last_processed_frame( |
| 1952 | &rrm_link_action_frm, |
| 1953 | rx_pkt_info); |
| 1954 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1955 | break; |
| 1956 | case SIR_MAC_RRM_NEIGHBOR_RPT: |
| 1957 | __lim_process_neighbor_report(mac_ctx, |
| 1958 | (uint8_t *)rx_pkt_info, |
| 1959 | session); |
| 1960 | break; |
| 1961 | default: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1962 | pe_warn("Action ID: %d not handled in RRM", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1963 | action_hdr->actionID); |
| 1964 | break; |
| 1965 | |
| 1966 | } |
| 1967 | } else { |
| 1968 | /* Else we will just ignore the RRM messages. */ |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1969 | pe_debug("RRM frm ignored, it is disabled in cfg: %d or DHCP not completed: %d", |
Abhishek Singh | ca40803 | 2016-09-13 15:26:12 +0530 | [diff] [blame] | 1970 | mac_ctx->rrm.rrmPEContext.rrmEnable, |
| 1971 | mac_ctx->roam.roamSession |
| 1972 | [session->smeSessionId].dhcp_done); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1973 | } |
| 1974 | break; |
Deepak Dhamdhere | 641bf32 | 2016-01-06 15:19:03 -0800 | [diff] [blame] | 1975 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1976 | case SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY: |
| 1977 | vendor_specific = (tpSirMacVendorSpecificFrameHdr) action_hdr; |
| 1978 | mac_hdr = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1979 | |
| 1980 | mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
Vignesh Viswanathan | 5f37b21 | 2018-06-07 16:15:56 +0530 | [diff] [blame] | 1981 | |
| 1982 | if (frame_len < sizeof(*vendor_specific)) { |
| 1983 | pe_debug("frame len %d less than Vendor Specific Hdr len", |
| 1984 | frame_len); |
| 1985 | return; |
| 1986 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1987 | |
| 1988 | /* Check if it is a vendor specific action frame. */ |
| 1989 | if (LIM_IS_STA_ROLE(session) && |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 1990 | (!qdf_mem_cmp(session->selfMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1991 | &mac_hdr->da[0], sizeof(tSirMacAddr))) |
| 1992 | && IS_WES_MODE_ENABLED(mac_ctx) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1993 | && !qdf_mem_cmp(vendor_specific->Oui, oui, 3)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 1994 | pe_debug("Rcvd Vendor specific frame OUI: %x %x %x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1995 | vendor_specific->Oui[0], |
| 1996 | vendor_specific->Oui[1], |
| 1997 | vendor_specific->Oui[2]); |
| 1998 | /* |
| 1999 | * Forward to the SME to HDD to wpa_supplicant |
| 2000 | * type is ACTION |
| 2001 | */ |
| 2002 | lim_send_sme_mgmt_frame_ind(mac_ctx, |
| 2003 | mac_hdr->fc.subType, |
| 2004 | (uint8_t *) mac_hdr, |
| 2005 | frame_len + |
| 2006 | sizeof(tSirMacMgmtHdr), |
| 2007 | session->smeSessionId, |
| 2008 | WMA_GET_RX_CH(rx_pkt_info), |
yeshwanth sriram guntuka | 2bc1435 | 2017-04-26 13:07:32 +0530 | [diff] [blame] | 2009 | session, |
| 2010 | WMA_GET_RX_RSSI_NORMALIZED( |
| 2011 | rx_pkt_info)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2012 | } else { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 2013 | pe_debug("Dropping the vendor specific action frame" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2014 | "beacause of (WES Mode not enabled " |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 2015 | "(WESMODE: %d) or OUI mismatch " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2016 | "(%02x %02x %02x) or not received with" |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 2017 | "SelfSta address) system role: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2018 | IS_WES_MODE_ENABLED(mac_ctx), |
| 2019 | vendor_specific->Oui[0], |
| 2020 | vendor_specific->Oui[1], |
| 2021 | vendor_specific->Oui[2], |
| 2022 | GET_LIM_SYSTEM_ROLE(session)); |
| 2023 | } |
| 2024 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2025 | case SIR_MAC_ACTION_PUBLIC_USAGE: |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2026 | mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2027 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2028 | switch (action_hdr->actionID) { |
Vignesh Viswanathan | 117c203 | 2017-12-20 12:31:11 +0530 | [diff] [blame] | 2029 | case SIR_MAC_ACTION_EXT_CHANNEL_SWITCH_ID: |
| 2030 | lim_process_ext_channel_switch_action_frame(mac_ctx, |
| 2031 | rx_pkt_info, session); |
| 2032 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2033 | case SIR_MAC_ACTION_VENDOR_SPECIFIC: |
| 2034 | pub_action = |
| 2035 | (tpSirMacVendorSpecificPublicActionFrameHdr) |
| 2036 | action_hdr; |
Vignesh Viswanathan | 5f37b21 | 2018-06-07 16:15:56 +0530 | [diff] [blame] | 2037 | if (frame_len < sizeof(*pub_action)) { |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2038 | pe_debug("Received vendor specific public action frame of invalid len %d", |
| 2039 | frame_len); |
| 2040 | return; |
| 2041 | } |
Vignesh Viswanathan | 117c203 | 2017-12-20 12:31:11 +0530 | [diff] [blame] | 2042 | /* |
| 2043 | * Check if it is a DPP public action frame and fall |
| 2044 | * thru, else drop the frame. |
| 2045 | */ |
| 2046 | if (qdf_mem_cmp(pub_action->Oui, dpp_oui, 4)) { |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 2047 | pe_debug("Unhandled public action frame (Vendor specific) OUI: %x %x %x %x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2048 | pub_action->Oui[0], pub_action->Oui[1], |
| 2049 | pub_action->Oui[2], pub_action->Oui[3]); |
Vignesh Viswanathan | 117c203 | 2017-12-20 12:31:11 +0530 | [diff] [blame] | 2050 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2051 | } |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2052 | /* Fall through to send the frame to supplicant */ |
Samuel Ahn | 065e649 | 2016-09-30 22:48:09 +0530 | [diff] [blame] | 2053 | case SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2054 | case SIR_MAC_ACTION_2040_BSS_COEXISTENCE: |
Vignesh Viswanathan | 117c203 | 2017-12-20 12:31:11 +0530 | [diff] [blame] | 2055 | case SIR_MAC_ACTION_GAS_INITIAL_REQUEST: |
| 2056 | case SIR_MAC_ACTION_GAS_INITIAL_RESPONSE: |
| 2057 | case SIR_MAC_ACTION_GAS_COMEBACK_REQUEST: |
| 2058 | case SIR_MAC_ACTION_GAS_COMEBACK_RESPONSE: |
Vignesh Viswanathan | 117c203 | 2017-12-20 12:31:11 +0530 | [diff] [blame] | 2059 | /* |
| 2060 | * Forward to the SME to HDD to wpa_supplicant |
| 2061 | * type is ACTION |
| 2062 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2063 | lim_send_sme_mgmt_frame_ind(mac_ctx, |
| 2064 | mac_hdr->fc.subType, |
| 2065 | (uint8_t *) mac_hdr, |
| 2066 | frame_len + sizeof(tSirMacMgmtHdr), |
| 2067 | session->smeSessionId, |
yeshwanth sriram guntuka | 2bc1435 | 2017-04-26 13:07:32 +0530 | [diff] [blame] | 2068 | WMA_GET_RX_CH(rx_pkt_info), session, |
| 2069 | WMA_GET_RX_RSSI_NORMALIZED( |
| 2070 | rx_pkt_info)); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 2071 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2072 | default: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 2073 | pe_warn("Unhandled public action frame: %x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2074 | action_hdr->actionID); |
| 2075 | break; |
| 2076 | } |
| 2077 | break; |
| 2078 | |
| 2079 | #ifdef WLAN_FEATURE_11W |
| 2080 | case SIR_MAC_ACTION_SA_QUERY: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 2081 | pe_debug("SA Query Action category: %d action: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2082 | action_hdr->category, action_hdr->actionID); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2083 | switch (action_hdr->actionID) { |
| 2084 | case SIR_MAC_SA_QUERY_REQ: |
| 2085 | /**11w SA query request action frame received**/ |
| 2086 | /* Respond directly to the incoming request in LIM */ |
| 2087 | __lim_process_sa_query_request_action_frame(mac_ctx, |
| 2088 | (uint8_t *)rx_pkt_info, |
| 2089 | session); |
| 2090 | break; |
| 2091 | case SIR_MAC_SA_QUERY_RSP: |
| 2092 | /**11w SA query response action frame received**/ |
| 2093 | /* Handle based on the current SA Query state */ |
| 2094 | __lim_process_sa_query_response_action_frame(mac_ctx, |
| 2095 | (uint8_t *)rx_pkt_info, |
| 2096 | session); |
| 2097 | break; |
| 2098 | default: |
| 2099 | break; |
| 2100 | } |
| 2101 | break; |
| 2102 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2103 | case SIR_MAC_ACTION_VHT: |
| 2104 | if (!session->vhtCapability) |
| 2105 | break; |
| 2106 | switch (action_hdr->actionID) { |
| 2107 | case SIR_MAC_VHT_OPMODE_NOTIFICATION: |
| 2108 | __lim_process_operating_mode_action_frame(mac_ctx, |
| 2109 | rx_pkt_info, session); |
| 2110 | break; |
| 2111 | case SIR_MAC_VHT_GID_NOTIFICATION: |
| 2112 | /* Only if ini supports it */ |
| 2113 | if (session->enableVhtGid) |
| 2114 | __lim_process_gid_management_action_frame( |
| 2115 | mac_ctx, rx_pkt_info, session); |
| 2116 | break; |
| 2117 | default: |
| 2118 | break; |
| 2119 | } |
| 2120 | break; |
Naveen Rawat | b493844 | 2015-11-13 09:58:27 -0800 | [diff] [blame] | 2121 | case SIR_MAC_ACTION_FST: { |
| 2122 | tpSirMacMgmtHdr hdr; |
Naveen Rawat | b493844 | 2015-11-13 09:58:27 -0800 | [diff] [blame] | 2123 | |
| 2124 | hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
Naveen Rawat | b493844 | 2015-11-13 09:58:27 -0800 | [diff] [blame] | 2125 | |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 2126 | pe_debug("Received FST MGMT action frame"); |
Naveen Rawat | b493844 | 2015-11-13 09:58:27 -0800 | [diff] [blame] | 2127 | /* Forward to the SME to HDD */ |
| 2128 | lim_send_sme_mgmt_frame_ind(mac_ctx, hdr->fc.subType, |
| 2129 | (uint8_t *)hdr, |
| 2130 | frame_len + sizeof(tSirMacMgmtHdr), |
| 2131 | session->smeSessionId, |
| 2132 | WMA_GET_RX_CH(rx_pkt_info), |
yeshwanth sriram guntuka | 2bc1435 | 2017-04-26 13:07:32 +0530 | [diff] [blame] | 2133 | session, |
| 2134 | WMA_GET_RX_RSSI_NORMALIZED( |
| 2135 | rx_pkt_info)); |
Naveen Rawat | b493844 | 2015-11-13 09:58:27 -0800 | [diff] [blame] | 2136 | break; |
| 2137 | } |
Krishna Kumaar Natarajan | 6553ea1 | 2016-09-02 12:28:07 -0700 | [diff] [blame] | 2138 | case SIR_MAC_ACTION_PROT_DUAL_PUB: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 2139 | pe_debug("Rcvd Protected Dual of Public Action: %d", |
Krishna Kumaar Natarajan | 6553ea1 | 2016-09-02 12:28:07 -0700 | [diff] [blame] | 2140 | action_hdr->actionID); |
| 2141 | switch (action_hdr->actionID) { |
| 2142 | case SIR_MAC_PDPA_GAS_INIT_REQ: |
| 2143 | case SIR_MAC_PDPA_GAS_INIT_RSP: |
| 2144 | case SIR_MAC_PDPA_GAS_COMEBACK_REQ: |
| 2145 | case SIR_MAC_PDPA_GAS_COMEBACK_RSP: |
| 2146 | mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
Krishna Kumaar Natarajan | 6553ea1 | 2016-09-02 12:28:07 -0700 | [diff] [blame] | 2147 | rssi = WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info); |
| 2148 | lim_send_sme_mgmt_frame_ind(mac_ctx, |
| 2149 | mac_hdr->fc.subType, (uint8_t *) mac_hdr, |
| 2150 | frame_len + sizeof(tSirMacMgmtHdr), |
| 2151 | session->smeSessionId, |
| 2152 | WMA_GET_RX_CH(rx_pkt_info), session, rssi); |
| 2153 | break; |
| 2154 | default: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 2155 | pe_warn("Unhandled - Protected Dual Public Action"); |
Krishna Kumaar Natarajan | 6553ea1 | 2016-09-02 12:28:07 -0700 | [diff] [blame] | 2156 | break; |
| 2157 | } |
| 2158 | break; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 2159 | case SIR_MAC_ACTION_BLKACK: |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 2160 | pe_debug("Rcvd Block Ack for %pM; action: %d", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 2161 | session->selfMacAddr, action_hdr->actionID); |
| 2162 | switch (action_hdr->actionID) { |
| 2163 | case SIR_MAC_ADDBA_REQ: |
| 2164 | lim_process_addba_req(mac_ctx, rx_pkt_info, session); |
| 2165 | break; |
| 2166 | case SIR_MAC_DELBA_REQ: |
| 2167 | lim_process_delba_req(mac_ctx, rx_pkt_info, session); |
| 2168 | break; |
| 2169 | default: |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 2170 | pe_err("Unhandle BA action frame"); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 2171 | break; |
| 2172 | } |
| 2173 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2174 | default: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 2175 | pe_warn("Action category: %d not handled", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2176 | action_hdr->category); |
| 2177 | break; |
| 2178 | } |
| 2179 | } |
| 2180 | |
| 2181 | /** |
| 2182 | * lim_process_action_frame_no_session |
| 2183 | * |
| 2184 | ***FUNCTION: |
| 2185 | * This function is called by limProcessMessageQueue() upon |
| 2186 | * Action frame reception and no session. |
| 2187 | * Currently only public action frames can be received from |
| 2188 | * a non-associated station. |
| 2189 | * |
| 2190 | ***LOGIC: |
| 2191 | * |
| 2192 | ***ASSUMPTIONS: |
| 2193 | * |
| 2194 | ***NOTE: |
| 2195 | * |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 2196 | * @param mac - Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2197 | * @param *pBd - A pointer to Buffer descriptor + associated PDUs |
| 2198 | * @return None |
| 2199 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 2200 | void lim_process_action_frame_no_session(struct mac_context *mac, uint8_t *pBd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2201 | { |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2202 | tpSirMacMgmtHdr mac_hdr = WMA_GET_RX_MAC_HEADER(pBd); |
| 2203 | uint32_t frame_len = WMA_GET_RX_PAYLOAD_LEN(pBd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2204 | uint8_t *pBody = WMA_GET_RX_MPDU_DATA(pBd); |
Vignesh Viswanathan | 117c203 | 2017-12-20 12:31:11 +0530 | [diff] [blame] | 2205 | uint8_t dpp_oui[] = { 0x50, 0x6F, 0x9A, 0x1A }; |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2206 | tpSirMacActionFrameHdr action_hdr = (tpSirMacActionFrameHdr) pBody; |
| 2207 | tpSirMacVendorSpecificPublicActionFrameHdr vendor_specific; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2208 | |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2209 | pe_debug("Received an Action frame -- no session"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2210 | |
Vignesh Viswanathan | 5f37b21 | 2018-06-07 16:15:56 +0530 | [diff] [blame] | 2211 | if (frame_len < sizeof(*action_hdr)) { |
| 2212 | pe_debug("frame_len %d less than action frame header len", |
| 2213 | frame_len); |
| 2214 | return; |
| 2215 | } |
| 2216 | |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2217 | switch (action_hdr->category) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2218 | case SIR_MAC_ACTION_PUBLIC_USAGE: |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2219 | switch (action_hdr->actionID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2220 | case SIR_MAC_ACTION_VENDOR_SPECIFIC: |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2221 | vendor_specific = |
| 2222 | (tpSirMacVendorSpecificPublicActionFrameHdr) |
| 2223 | action_hdr; |
| 2224 | |
Vignesh Viswanathan | 5f37b21 | 2018-06-07 16:15:56 +0530 | [diff] [blame] | 2225 | if (frame_len < sizeof(*vendor_specific)) { |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2226 | pe_debug("Received vendor specific public action frame of invalid len %d", |
| 2227 | frame_len); |
| 2228 | return; |
| 2229 | } |
Vignesh Viswanathan | 117c203 | 2017-12-20 12:31:11 +0530 | [diff] [blame] | 2230 | /* |
| 2231 | * Check if it is a DPP public action frame and fall |
| 2232 | * thru, else drop the frame. |
| 2233 | */ |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2234 | if (qdf_mem_cmp(vendor_specific->Oui, dpp_oui, 4)) { |
Vignesh Viswanathan | 117c203 | 2017-12-20 12:31:11 +0530 | [diff] [blame] | 2235 | pe_debug("Unhandled public action frame (Vendor specific) OUI: %x %x %x %x", |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2236 | vendor_specific->Oui[0], |
| 2237 | vendor_specific->Oui[1], |
| 2238 | vendor_specific->Oui[2], |
| 2239 | vendor_specific->Oui[3]); |
Vignesh Viswanathan | 117c203 | 2017-12-20 12:31:11 +0530 | [diff] [blame] | 2240 | break; |
| 2241 | } |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2242 | /* Fall through to send the frame to supplicant */ |
Vignesh Viswanathan | 117c203 | 2017-12-20 12:31:11 +0530 | [diff] [blame] | 2243 | case SIR_MAC_ACTION_GAS_INITIAL_REQUEST: |
| 2244 | case SIR_MAC_ACTION_GAS_INITIAL_RESPONSE: |
| 2245 | case SIR_MAC_ACTION_GAS_COMEBACK_REQUEST: |
| 2246 | case SIR_MAC_ACTION_GAS_COMEBACK_RESPONSE: |
Vignesh Viswanathan | 117c203 | 2017-12-20 12:31:11 +0530 | [diff] [blame] | 2247 | /* |
| 2248 | * Forward the GAS frames to wpa_supplicant |
| 2249 | * type is ACTION |
| 2250 | */ |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 2251 | lim_send_sme_mgmt_frame_ind(mac, |
Vignesh Viswanathan | 117c203 | 2017-12-20 12:31:11 +0530 | [diff] [blame] | 2252 | mac_hdr->fc.subType, |
| 2253 | (uint8_t *) mac_hdr, |
| 2254 | frame_len + sizeof(tSirMacMgmtHdr), 0, |
| 2255 | WMA_GET_RX_CH(pBd), NULL, |
| 2256 | WMA_GET_RX_RSSI_NORMALIZED(pBd)); |
| 2257 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2258 | default: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 2259 | pe_warn("Unhandled public action frame: %x", |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2260 | action_hdr->actionID); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2261 | break; |
| 2262 | } |
| 2263 | break; |
| 2264 | default: |
Nishank Aggarwal | d3d7046 | 2017-03-23 12:57:40 +0530 | [diff] [blame] | 2265 | pe_warn("Unhandled action frame without session: %x", |
Vignesh Viswanathan | 167f8ac | 2018-02-09 23:29:11 +0530 | [diff] [blame] | 2266 | action_hdr->category); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2267 | break; |
| 2268 | |
| 2269 | } |
| 2270 | } |